-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
37 lines (34 loc) · 1.4 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
variables:
DOCKER_VERSION: "18.09.9"
VMTOUCH_VERSION: "1.3.1"
ALPINE_VERSION: "3.12"
REVISION: "r0"
stages:
- docker
- docker-tag
docker-cacher:
stage: docker
image: docker:${DOCKER_VERSION}
script:
- echo "$CI_JOB_TOKEN" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin # An GitLab-Registry anmelden
- docker build
--pull
--build-arg ALPINE_VERSION="${ALPINE_VERSION}"
-t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
. # Docker Image bauen
- docker push $CI_REGISTRY_IMAGE # Image in GitLab-Docker-Registry pushen
- docker image rm $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
docker-tag-latest:
stage: docker-tag
image: docker:${DOCKER_VERSION}
script:
- echo "$CI_JOB_TOKEN" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:latest
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:${ALPINE_VERSION}-${VMTOUCH_VERSION}-${REVISION}
- docker push $CI_REGISTRY_IMAGE
- docker image rm $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker image rm $CI_REGISTRY_IMAGE:${ALPINE_VERSION}-${VMTOUCH_VERSION}-${REVISION}
- docker image rm $CI_REGISTRY_IMAGE:latest
only:
- master