forked from onlinejudge95/Flask-REST-Container
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
59 lines (54 loc) · 1.34 KB
/
.gitlab-ci.yml
File metadata and controls
59 lines (54 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
image: docker:stable
stages:
- test
- build
- deploy
variables:
IMAGE: registry.gitlab.com/onlinejudge95/flask-rest-container
test:
stage: test
image: $IMAGE:latest
services:
- postgres:latest
variables:
POSTGRES_DB: users
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
DATABASE_TEST_URL: postgres://runner@postgres:5432/users
script:
- pytest app/tests/unit/* --cov-report xml:coverage/xml/unit
- pytest app/tests/functional/* --cov-report xml:coverage/xml/functional
build:
stage: build
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $IMAGE:latest || true
- docker build
--cache-from $IMAGE:latest
--tag $IMAGE:latest
--file prod.Dockerfile
"."
- docker push $IMAGE:latest
deploy:
stage: deploy
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
HEROKU_APP_NAME: rest-container-staging
HEROKU_REGISTRY_IMAGE: registry.heroku.com/${HEROKU_APP_NAME}/web
script:
- apk add --no-cache curl
- docker build
--tag $HEROKU_REGISTRY_IMAGE
--file prod.Dockerfile
"."
- docker login -u _ -p $HEROKU_AUTH_TOKEN registry.heroku.com
- docker push $HEROKU_REGISTRY_IMAGE
- ./release.sh
only:
- master