Skip to content

Instantly share code, notes, and snippets.

@adamyordan
Created March 6, 2019 04:59
Show Gist options
  • Save adamyordan/6fc215fc5279754cd23912826f733da0 to your computer and use it in GitHub Desktop.
Save adamyordan/6fc215fc5279754cd23912826f733da0 to your computer and use it in GitHub Desktop.
GitLab CI config file to build docker images
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
before_script:
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
development:
stage: deploy
script:
- docker build -t "$CI_REGISTRY_IMAGE:dev" .
- docker push "$CI_REGISTRY_IMAGE:dev"
only:
- develop
stable:
stage: deploy
script:
- docker build -t "$CI_REGISTRY_IMAGE:stable" .
- docker push "$CI_REGISTRY_IMAGE:stable"
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment