Last active
August 14, 2018 15:43
-
-
Save jinhduong/9fe41b03d1edac567e16a1a384a07163 to your computer and use it in GitHub Desktop.
Gitlab CICD
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
build_image: | |
image: docker:git | |
services: | |
- docker:dind | |
script: | |
# Login to Gitlab Registry | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com | |
# Build image | |
- docker build -t registry.gitlab.com/<username>/<repo-name>/<docker-name>:latest --build-arg env=sandbox --build-arg <SOME-ARG>=<VALUE> . | |
# Then push image | |
- docker push registry.gitlab.com/<username>/<repo-name>/<docker-name>:latest | |
only: | |
- sandbox | |
build_app_image: | |
image: docker:git | |
services: | |
- docker:dind | |
script: | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com | |
- docker build -t registry.gitlab.com/<username>/<repo-name>/<docker-name>:latest --build-arg env=prod --build-arg <SOME-ARG>=<VALUE> . | |
- docker push registry.gitlab.com/<username>/<repo-name>/<docker-name>:latest | |
only: | |
- master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment