Created
October 22, 2020 05:50
-
-
Save ahmadarif/e79f59a6da6da759650a8af85168f7e8 to your computer and use it in GitHub Desktop.
Simple Gitlab Pipeline (Docker Builder)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- build | |
build: | |
stage: build | |
image: docker:19.03.12 | |
services: | |
- docker:19.03.12-dind | |
variables: | |
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG | |
script: | |
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY | |
- docker build -t $IMAGE_TAG . | |
- docker push $IMAGE_TAG | |
- ([ "${CI_COMMIT_REF_NAME}" == "master" ] && docker build -t $CI_REGISTRY_IMAGE:latest .) || echo "Not latest build" | |
- ([ "${CI_COMMIT_REF_NAME}" == "master" ] && docker push $CI_REGISTRY_IMAGE:latest) || echo "Not latest build" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment