Skip to content

Instantly share code, notes, and snippets.

@esys
Last active October 28, 2020 08:21
Show Gist options
  • Save esys/930b3f74d60c5c06d12d0185da056461 to your computer and use it in GitHub Desktop.
Save esys/930b3f74d60c5c06d12d0185da056461 to your computer and use it in GitHub Desktop.
gitlab pipeline with remote cache
stages:
- build
- test
- deploy
variables:
# disable Docker TLS validation
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: "tcp://localhost:2375"
services:
- docker:stable-dind
docker-build:
image: docker:stable
stage: build
script:
- docker pull my-registry/hello:latest || true
- docker build --cache-from my-registry/hello:latest -t hello:latest .
- docker tag hello:latest my-registry/hello:${CI_COMMIT_SHORT_SHA}
- docker tag hello:latest my-registry/hello:latest
- docker push my-registry/hello:${CI_COMMIT_SHORT_SHA}
- docker push my-registry/hello:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment