Commit 819deae3 authored by David Foucher's avatar David Foucher

Add docker files

parent 03a5619c
Pipeline #1919 passed with stage
in 1 minute and 39 seconds
image: python:3.6
#TODO test docker image with https://github.com/aelsabbahy/goss
cache:
paths:
- ~/.cache/pip/
api publish:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR}/docker --dockerfile $CI_PROJECT_DIR/docker/dockerfile_trefle --build-arg TREFLE_VERSION=$CI_COMMIT_TAG --build-arg TREFLE_GIT=${CI_PROJECT_URL} --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- /^api-v[0-9.]+$/
before_script:
- python setup.py develop
- pip install -r requirements-dev.txt
backoffice publish:
variables:
TREFLE_OLD_VERSION: "api-v0.6.1"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR}/docker --dockerfile ${CI_PROJECT_DIR}/docker/dockerfile_backoffice --build-arg TREFLE_VERSION=${CI_COMMIT_TAG} --build-arg TREFLE_OLD_VERSION=${TREFLE_OLD_VERSION} --build-arg TREFLE_GIT=${CI_PROJECT_URL} --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- /^backoffice-v[0-9.]+$/
test:
image: python:3.6
cache:
paths:
- ~/.cache/pip/
before_script:
- python setup.py develop
- pip install -r requirements-dev.txt
stage: test
script:
- py.test -v --cov
- behave -D coverage-format=long
- py.test -v --cov
- behave -D coverage-format=long
only:
- branches
- master
server {
listen 80 default_server;
server_name trefle.pole-emploi.fr trefle.beta.pole-emploi.fr trefle-labonneformation.beta.pole-emploi.fr trefle-labonneformation.pole-emploi.fr;
charset utf-8;
client_max_body_size 25M;
location @gunicorn-master {
proxy_pass http://trefle:8000;
proxy_redirect off;
proxy_set_header Host $host;
}
location = / {
root /srv/trefle/trefle;
rewrite ^/$ /0.7/explorer last;
}
location /0.7 {
root /srv/trefle/trefle;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location /0.7/explorer {
alias /srv/trefle/trefle/explorer;
index index.html;
}
rewrite /0.7/(.*) /$1 break;
try_files $uri @gunicorn-master;
}
location /api-moteur/0.7 {
rewrite /api-moteur/0.7/(.*) /$1 break;
try_files $uri @gunicorn-master;
}
location ^~ {
rewrite ^/(.*)$ /0.7/$1 last;
}
#previous API version
location @gunicorn-old {
proxy_pass http://trefle-old:8000;
proxy_redirect off;
proxy_set_header Host $host;
}
location /0.6 {
root /srv/trefle-old/trefle;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location /0.6/explorer {
alias /srv/trefle-old/trefle/explorer;
index index.html;
}
rewrite /0.6/(.*) /$1 break;
try_files $uri @gunicorn-old;
}
location /api-moteur/0.6 {
rewrite /api-moteur/0.6/(.*) /$1 break;
try_files $uri @gunicorn-old;
}
}
version: "3.3"
services:
trefle:
restart: unless-stopped
build:
context: .
dockerfile: dockerfile_trefle
args:
- TREFLE_VERSION=${VERSION}
- TREFLE_GIT=${TREFLE_GIT:-https://git.beta.pole-emploi.fr/open-source/trefle.git}
volumes:
- ./log/trefle:/srv/log
environment:
- LBF_CHARMAP=${LBF_CHARMAP}
- CATALOG_USER=${CATALOG_USER}
- CATALOG_KEY=${CATALOG_KEY}
- CATALOG_URL=${CATALOG_URL}
#version majeur précédente
trefle-old:
restart: unless-stopped
build:
context: .
dockerfile: dockerfile_trefle
args:
- TREFLE_VERSION=${OLD_VERSION}
- TREFLE_GIT=${TREFLE_GIT:-https://git.beta.pole-emploi.fr/open-source/trefle.git}
volumes:
- ./log/trefle-old:/srv/log
environment:
- LBF_CHARMAP=${LBF_CHARMAP}
- CATALOG_USER=${CATALOG_USER}
- CATALOG_KEY=${CATALOG_KEY}
- CATALOG_URL=${CATALOG_URL}
backoffice:
restart: unless-stopped
build:
context: .
dockerfile: dockerfile_backoffice
args:
- TREFLE_GIT=${TREFLE_GIT:-https://git.beta.pole-emploi.fr/open-source/trefle.git}
- TREFLE_VERSION=${VERSION}
- TREFLE_OLD_VERSION=${OLD_VERSION}
depends_on:
- trefle
- trefle-old
volumes: