-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
58 lines (52 loc) · 2.07 KB
/
.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
REGISTRY: registry.gitlab.com
IMAGE_REPOSITORY: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
CONTAINER_TEST_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:$CI_COMMIT_REF_NAME
DOCKER_UMBU_REPOSITORY_BASE: nsantana/zappa-docker
DOCKER_UMBU_REPOSITORY_PYTHON_27_BASE: ${DOCKER_UMBU_REPOSITORY_BASE}:2.7
DOCKER_UMBU_REPOSITORY_PYTHON_35_BASE: ${DOCKER_UMBU_REPOSITORY_BASE}:3.6
before_script:
- echo "Login"
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- echo $PASSWORD_DOCKER_HUB | docker login --username nsantana --password-stdin
- date=$(date +%Y-%m)
- export DOCKER_UMBU_REPOSITORY_PYTHON_27=$DOCKER_UMBU_REPOSITORY_PYTHON_27_BASE-$date
- export DOCKER_UMBU_REPOSITORY_PYTHON_35=$DOCKER_UMBU_REPOSITORY_PYTHON_35_BASE-$date
stages:
- build
build_python_2.7:
stage: build
script:
- git checkout $CI_COMMIT_REF_NAME
- echo "Directory:" $(pwd)
- git pull origin $CI_COMMIT_REF_NAME
- echo "Branch:" $(git rev-parse --abbrev-ref HEAD)
- docker build -f ./python-2.7/Dockerfile --pull -t $CONTAINER_TEST_IMAGE ./python-2.7
- docker tag $CONTAINER_TEST_IMAGE $DOCKER_UMBU_REPOSITORY_PYTHON_27
- docker tag $CONTAINER_TEST_IMAGE $DOCKER_UMBU_REPOSITORY_PYTHON_27_BASE
- docker push $DOCKER_UMBU_REPOSITORY_PYTHON_27
- docker push $DOCKER_UMBU_REPOSITORY_PYTHON_27_BASE
only:
- /^v.*$/
- master
tags:
- build
build_python_3.6:
stage: build
script:
- git checkout $CI_COMMIT_REF_NAME
- echo "Directory:" $(pwd)
- git pull origin $CI_COMMIT_REF_NAME
- echo "Branch:" $(git rev-parse --abbrev-ref HEAD)
- docker build -f ./python-3.6/Dockerfile --pull -t $CONTAINER_TEST_IMAGE ./python-3.6
- docker tag $CONTAINER_TEST_IMAGE $DOCKER_UMBU_REPOSITORY_PYTHON_35
- docker tag $CONTAINER_TEST_IMAGE $DOCKER_UMBU_REPOSITORY_PYTHON_35_BASE
- docker push $DOCKER_UMBU_REPOSITORY_PYTHON_35
- docker push $DOCKER_UMBU_REPOSITORY_PYTHON_35_BASE
only:
- /^v.*$/
- master
tags:
- build