...
 
Commits (2)
  • Kevin Daudt's avatar
    docker-image: use artifacts to persist images · 27a09cd0
    Kevin Daudt authored
    The docker-image ci job relies on docker to persist images so that they
    can be used in different stages. This only works when all stages are
    executed on the same host.
    
    This prevents the use of multiple runners, as different jobs may be
    executed on different runners.
    
    To fix this, we can use the artifacts feature of gitlab. We use `docker
    image save` to create a tar archive of the image, which is then
    persisted by gitlab for following stages.
    27a09cd0
  • Kevin Daudt's avatar
    merge: let gitlab-ci persist build artifact for following stages · 328914f8
    Kevin Daudt authored
    See merge request !4
    328914f8
......@@ -9,9 +9,18 @@ stages:
stage: build
script:
- docker build -t $CI_PROJECT_NAME:latest-$ARCH .
after_script:
- mkdir -p docker-images
- >
docker image save $CI_PROJECT_NAME:latest-$ARCH | gzip - >
docker-images/${CI_PROJECT_NAME}_latest-${ARCH}.tar.gz
artifacts:
paths:
- docker-images/*.tar.gz
expire_in: 1h
.build_with_arch:
stage: build
extends: .build
script:
- docker build --build-arg ARCH=$DOCKER_ARCH/ -t $CI_PROJECT_NAME:latest-$ARCH .
......@@ -50,6 +59,7 @@ build-x86:
- tags
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- gunzip -c docker-images/${CI_PROJECT_NAME}_latest-${ARCH}.tar.gz | docker image load
script:
- >
docker-push-image
......@@ -97,6 +107,7 @@ create-manifest:
- docker-alpine
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- for image in docker-images/*.tar.gz; do gunzip -c "$image" | docker image load; done
script:
- >
docker-push-manifest $DOCKER_NAMESPACE/$CI_PROJECT_NAME:latest
......