forked from dfederschmidt/docker-pipenv-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
42 lines (35 loc) · 947 Bytes
/
.gitlab-ci.yml
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
image: docker:latest
stages:
- build
- test
- publish
variables:
PIPELINE_IMAGE_NAME: registry.gitlab.com/dfederschmidt/docker-pipenv-sample:$CI_BUILD_REF_NAME
RELEASE_IMAGE_NAME: registry.gitlab.com/dfederschmidt/docker-pipenv-sample:latest
services:
- docker:dind
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- apk update
- apk upgrade
- apk add python python-dev py-pip build-base
- pip install requests
build_image:
stage: build
script:
- docker build -t $PIPELINE_IMAGE_NAME .
- docker push $PIPELINE_IMAGE_NAME
run_tests:
stage: test
script:
- docker pull $PIPELINE_IMAGE_NAME
- docker run -d -p 5000:5000 $PIPELINE_IMAGE_NAME python test.py
push_to_registy:
stage: publish
only:
- master
script:
- docker pull $PIPELINE_IMAGE_NAME
- docker tag $PIPELINE_IMAGE_NAME $RELEASE_IMAGE_NAME
- docker push $RELEASE_IMAGE_NAME