📅  最后修改于: 2022-03-11 14:55:11.138000             🧑  作者: Mango
# _config-examples/multi-stage/.gitlab-ci.yml
image: docker:stable
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
CACHE_IMAGE: mjhea0/docker-ci-cache
DOCKER_BUILDKIT: 1
stages:
- build
docker-build:
stage: build
before_script:
- docker login -u $REGISTRY_USER -p $REGISTRY_PASS
script:
- docker build
--target base
--cache-from $CACHE_IMAGE:base
--tag $CACHE_IMAGE:base
--file ./Dockerfile.multi
--build-arg BUILDKIT_INLINE_CACHE=1
"."
- docker build
--cache-from $CACHE_IMAGE:base
--cache-from $CACHE_IMAGE:stage
--tag $CACHE_IMAGE:stage
--file ./Dockerfile.multi
--build-arg BUILDKIT_INLINE_CACHE=1
"."
after_script:
- docker push $CACHE_IMAGE:stage