Created
January 31, 2018 08:26
-
-
Save jiahaog/97d876a75995b83bb51be5fa66a380c7 to your computer and use it in GitHub Desktop.
Generic way to build docker images on GitLab
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
# Drop this file into GitLab repos containing a Dockerfile at the root | |
image: docker:1.12.3 | |
variables: | |
IMAGE_TAG: $CI_REGISTRY_IMAGE | |
before_script: | |
- docker info | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY | |
build: | |
stage: build | |
tags: | |
- docker | |
script: | |
- docker build --pull -t $IMAGE_TAG . | |
push: | |
stage: deploy | |
tags: | |
- docker | |
script: | |
- docker push $IMAGE_TAG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment