CI is swag

This commit is contained in:
Hugo LEVY-FALK 2018-12-14 20:40:29 +01:00
parent 27ebc37305
commit 1384f12a12
2 changed files with 41 additions and 1 deletions

40
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,40 @@
image: docker
services:
- docker:dind
before_script:
- apk add --no-cache curl
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab.rezometz.org:5678
stages:
- build
- deploy
.build_image: &build_image
stage: build
script:
- docker build -f Dockerfile -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
build_image_test:
<<: *build_image
stage: build
except:
- master
build_image_prod:
<<: *build_image
stage: build
after_script:
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
only:
- master
deploy:
stage: deploy
script:
- "curl -X POST lupercus.rez -d \"$API_VARS\" -H \"Content-Type: application/json\" --fail"
only:
- master
environment:
name: production

View file

@ -1,7 +1,7 @@
FROM python:3 FROM python:3
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
RUN mkdir /django RUN mkdir /django
ADD . /django/ ADD ./comet /django/
WORKDIR /django WORKDIR /django
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
CMD sleep 5; python manage.py migrate; python manage.py collectstatic --noinput; gunicorn comet.wsgi -b 0.0.0.0:8000 CMD sleep 5; python manage.py migrate; python manage.py collectstatic --noinput; gunicorn comet.wsgi -b 0.0.0.0:8000