Skip to content

Instantly share code, notes, and snippets.

@jiahaog
Created January 31, 2018 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiahaog/97d876a75995b83bb51be5fa66a380c7 to your computer and use it in GitHub Desktop.
Save jiahaog/97d876a75995b83bb51be5fa66a380c7 to your computer and use it in GitHub Desktop.
Generic way to build docker images on GitLab
# 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