Skip to content
Snippets Groups Projects
Commit c672670b authored by Vincent Mazenod's avatar Vincent Mazenod
Browse files

nice docker workflow

parent 9cd8820a
No related branches found
No related tags found
1 merge request!4Working docker
Pipeline #9314 failed
FROM debian:stable
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
locales \
rsync \
&& \
locale-gen fr_FR \
locale-gen fr_FR.UTF-8 \
update-locale LANG=fr_FR.UTF-8 \
. /etc/default/locale
COPY requirements.txt .
RUN pip install --user -r requirements.txt
WORKDIR /srv/blog
\ No newline at end of file
apt-get update
apt-get -y --no-install-recommends install python3 python3-pip #python3-gettext
cd /srv/blog
pip install --user -r requirements.txt
sed -i 's/\$port &/\$port/g' ./develop_server.sh
chmod +x develop_server.sh
export PATH=/root/.local/bin:$PATH
......
PORT=8000
REGISTRY_URL=docker.isima.fr
NAMESPACE=docker.isima.fr/vimazeno
APP_NAME=pelican_perso
......
image: docker.isima.fr/vimazeno/pelican_perso
cache:
paths:
- output/ # le répertoire où se trouve le HTML statique généré
install:
image: node:latest
stage: install
script:
- cd /srv/blog/content/slides && yarn
build:
image: docker.isima.fr/vimazeno/pelican_perso_python
stage: build
script:
- pelican
deploy:
image: docker.isima.fr/vimazeno/pelican_perso_kerberos
stage: deploy
script:
# récupération du KEYTAB en hexa
- ls
- echo "$KEYTAB" > my.keytab.hex
# conversion du KEYTAB en hexa en binaire
- sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' my.keytab.hex | xargs printf > my.keytab
......@@ -27,8 +37,4 @@ build:
- ssh -o StrictHostKeyChecking=no -K vimazeno@perso.local.isima.fr "echo ' Header set Content-Disposition attachment' >> ~/public_html/_/.htaccess"
- ssh -o StrictHostKeyChecking=no -K vimazeno@perso.local.isima.fr "echo '</FilesMatch>' >> ~/public_html/_/.htaccess"
# rsync du HTML statique généré
- rsync -az --exclude '_' -e "ssh -o StrictHostKeyChecking=no -K" output/ vimazeno@perso.local.isima.fr:~/public_html/
- ssh -o StrictHostKeyChecking=no -K vimazeno@perso.local.isima.fr "mkdir -p ~/public_html/node_modules"
- rsync -az -e "ssh -o StrictHostKeyChecking=no -K" content/node_modules/ vimazeno@perso.local.isima.fr:~/public_html/node_modules
# le déploiement se fera uniquement lorsque je clique sur le "play" de la CI via l'interface gitlab
when: manual
\ No newline at end of file
- rsync -az --exclude '_' -e "ssh -o StrictHostKeyChecking=no -K" output/ vimazeno@perso.local.isima.fr:~/public_html/
\ No newline at end of file
......@@ -22,21 +22,27 @@ include .env
build: ## Build required docker compose images
@$(DOCKER_COMP) build
@docker image prune -f --filter label=stage=source-image
@docker image prune -f --filter label=stage=build-image
.PHONY: build
push: ## Push build docker compose images
@TAG=$(shell git rev-parse --short HEAD)
@docker login ${REGISTRY_URL}
@docker push ${NAMESPACE}/${APP_NAME}:latest
@docker image tag ${NAMESPACE}/${APP_NAME}:latest ${NAMESPACE}/${APP_NAME}:${TAG}
@docker push ${NAMESPACE}/${APP_NAME}:${TAG} ;
@docker push ${NAMESPACE}/${APP_NAME}_python:latest ;
@docker tag ${NAMESPACE}/${APP_NAME}_python:latest ${NAMESPACE}/${APP_NAME}_python:${TAG} ;
@docker push ${NAMESPACE}/${APP_NAME}_python:${TAG} ;
@docker push ${NAMESPACE}/${APP_NAME}_kerberos:latest ;
@docker tag ${NAMESPACE}/${APP_NAME}_kerberos:latest ${NAMESPACE}/${APP_NAME}_kerberos:${TAG} ;
@docker push ${NAMESPACE}/${APP_NAME}_kerberos:${TAG} ;
.PHONY: push
up: ## Make required containers up
@$(DOCKER_COMP) up --remove-orphans node
# @$(DOCKER_COMP) run dockerize -timeout 180s -wait-retry-interval 3s \
# -wait file:///tmp/content/node_modules/.yarn-integrity ;
@echo -e "⏰ ${BOLD}${GREEN}Wait for node to install needed js (there's no problem we're just wait)...${RESET}"
@$(DOCKER_COMP) run dockerize -timeout 180s -wait-retry-interval 3s \
-wait file:///tmp/content/node_modules/.yarn-integrity ;
@echo -e "⏰ ${BOLD}${GREEN}Wait for pelican to generate content (there's no problem we're just wait)...${RESET}"
@echo -e "${GREEN}${BOLD}up and running${RESET}"
@echo -e " 🐳 blog in docker ${BLUE}${BOLD}http://localhost:${PORT}${RESET}"
@$(DOCKER_COMP) up --remove-orphans python
.PHONY: up
......
......@@ -4,7 +4,7 @@ services:
node:
image: node:latest
container_name: blog_node_dev
container_name: ${APP_NAME}_node
environment:
TZ: ${TIMEZONE:-Europe/Paris}
working_dir: /srv/blog
......@@ -13,23 +13,26 @@ services:
command: bash /srv/blog/.docker/scripts/node/command.dev.sh
python:
image: debian:stable
container_name: blog_python_dev
image: ${NAMESPACE}/${APP_NAME}_python:latest
build:
context: .
dockerfile: .docker/build/python/Dockerfile
container_name: ${APP_NAME}_python
environment:
TZ: ${TIMEZONE:-Europe/Paris}
working_dir: /srv/blog
volumes:
- .:/srv/blog
ports:
- "8000:8000"
- "${PORT-8000}:8000"
command: bash /srv/blog/.docker/scripts/python/command.dev.sh
kerberos:
image: ${NAMESPACE}/${APP_NAME}_kerberos_dev:latest
image: ${NAMESPACE}/${APP_NAME}_kerberos:latest
build:
context: .
dockerfile: .docker/build/kerberos/Dockerfile
container_name: blog_kerberos_dev
container_name: ${APP_NAME}_kerberos
environment:
TZ: ${TIMEZONE:-Europe/Paris}
volumes:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment