Commit fceadfc9 authored by David Foucher's avatar David Foucher

WIP add web

parent bfd89ff3
Pipeline #1894 passed with stage
in 2 minutes and 34 seconds
#TODO test docker image with https://github.com/aelsabbahy/goss
build-trefle:
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}:trefle-${CI_COMMIT_TAG}
- /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:
- /^trefle-v[0-9.]+$/
#build-web:
# 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_web --build-arg TREFLE_VERSION=$CI_COMMIT_TAG --build-arg TREFLE_GIT=${CI_PROJECT_URL} --destination ${CI_REGISTRY_IMAGE}:web-${CI_COMMIT_TAG}
# only:
# - tags
- /^api-v[0-9.]+$/
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_web --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
......
......@@ -21,10 +21,10 @@ RUN apt-get update && apt-get -y install \
# setup system
RUN mkdir -p ${TREFLE_LOG_DIR}
WORKDIR /srv
COPY etc/logrotate.d/gunicorn.logrotate /etc/logrotate.d/gunicorn
COPY trefle/etc/logrotate.d/gunicorn.logrotate /etc/logrotate.d/gunicorn
#deploy
COPY srv/gunicorn.conf.py ./gunicorn.conf.py
COPY trefle/srv/gunicorn.conf.py ./gunicorn.conf.py
# setup virtualenv
......@@ -33,5 +33,5 @@ RUN pip install pip -U && \
pip install git+${TREFLE_GIT}@${TREFLE_VERSION}
#start
COPY start.sh .
COPY trefle/start.sh .
ENTRYPOINT ./start.sh
FROM ubuntu:xenial
LABEL maintainer="labonneformation@pole-emploi.fr"
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y install \
apt-utils\
software-properties-common\
unzip \
nginx \
vim \
bzip2 \
cron \
logrotate \
iptables \
git \
dnsutils
ARG TREFLE_GIT
ARG TREFLE_VERSION
RUN git clone -b ${TREFLE_VERSION} ${TREFLE_GIT} /srv/trefle && \
chown -R www-data: /srv/trefle && \
chmod -R u+rwx /srv/trefle
ARG TREFLE_OLD_VERSION
RUN git clone -b ${TREFLE_OLD_VERSION} ${TREFLE_GIT} /srv/trefle-old && \
chown -R www-data: /srv/trefle-old && \
chmod -R u+rwx /srv/trefle-old
CMD service nginx start; \
cron -f
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;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment