1fb3c0334SPhilippe Mathieu-Daudé.container_job_template:
2e312d1fdSDaniel P. Berrangé  extends: .base_job_template
3ab725227SDaniel P. Berrangé  image: docker:latest
4fb3c0334SPhilippe Mathieu-Daudé  stage: containers
5fb3c0334SPhilippe Mathieu-Daudé  services:
6ab725227SDaniel P. Berrangé    - docker:dind
7fb3c0334SPhilippe Mathieu-Daudé  before_script:
8*d4c7a565SDaniel P. Berrangé    - export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:$QEMU_CI_CONTAINER_TAG"
9*d4c7a565SDaniel P. Berrangé    # Always ':latest' because we always use upstream as a common cache source
1094b8b146SFabiano Rosas    - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
11fb3c0334SPhilippe Mathieu-Daudé    - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
12b105ce60SCamilla Conte    - until docker info; do sleep 1; done
13fb3c0334SPhilippe Mathieu-Daudé  script:
14fb3c0334SPhilippe Mathieu-Daudé    - echo "TAG:$TAG"
15fb3c0334SPhilippe Mathieu-Daudé    - echo "COMMON_TAG:$COMMON_TAG"
1694b8b146SFabiano Rosas    - docker build --tag "$TAG" --cache-from "$TAG" --cache-from "$COMMON_TAG"
1794b8b146SFabiano Rosas      --build-arg BUILDKIT_INLINE_CACHE=1
1894b8b146SFabiano Rosas      -f "tests/docker/dockerfiles/$NAME.docker" "."
19fb3c0334SPhilippe Mathieu-Daudé    - docker push "$TAG"
20fb3c0334SPhilippe Mathieu-Daudé  after_script:
21fb3c0334SPhilippe Mathieu-Daudé    - docker logout
22