-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
32 lines (30 loc) · 1.18 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
stages:
- build_and_push
- build_only
build:
stage: build_and_push
variables:
GIT_STRATEGY: clone
script:
- docker build --no-cache --build-arg DOCKER_POSTFIX_VERSION=$CI_COMMIT_TAG --build-arg CACHEBUST=$(date +%s) -t postfix:$CI_COMMIT_TAG .
- echo $AFACTORY_TOKEN | docker login -u $AFACTORY_USER --password-stdin $AFACTORY_URL
# Push the image using the same tag as the current commit
- docker tag postfix:$CI_COMMIT_TAG $AFACTORY_URL/geant-devops-docker/postfix:$CI_COMMIT_TAG
- docker image push $AFACTORY_URL/geant-devops-docker/postfix:$CI_COMMIT_TAG
# Push the image using the 'latest' tag
- curl -u"${AFACTORY_USER}:${AFACTORY_TOKEN}" -X DELETE https://${AFACTORY_URL}/artifactory/geant-devops-docker/postfix/latest
- docker tag postfix:$CI_COMMIT_TAG $AFACTORY_URL/geant-devops-docker/postfix:latest
- docker image push $AFACTORY_URL/geant-devops-docker/postfix:latest
only:
- tags
tags:
- gitlab-runner03-shell01-tag4
manual-build:
stage: build_only
when: manual
variables:
GIT_STRATEGY: clone
script:
- docker build --no-cache --build-arg CACHEBUST=$(date +%s) -t postfix .
tags:
- gitlab-runner03-shell01-tag4