From a4ee2007d0b7228b2719111e65bae7447e6d78ac Mon Sep 17 00:00:00 2001 From: Matej Sima Date: Mon, 27 May 2019 14:09:13 +0200 Subject: [PATCH] Persist docker image as an artifact --- .gitlab-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2db2fadab..bf5a728b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -82,6 +82,10 @@ build-current-docker-image: <<: *docker script: - docker build -t $CI_REGISTRY_IMAGE:latest -f ./docker/Dockerfile . + - docker save $CI_REGISTRY_IMAGE:latest > $CI_REGISTRY_IMAGE:latest + artifacts: + paths: + - $CI_REGISTRY_IMAGE:latest # When a MR/PR is merged to master # take the previous build and publish it to Docker Hub @@ -91,8 +95,9 @@ build-and-publish-latest-docker-image: dependencies: - build-current-docker-image before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY_URL + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD script: + - docker load -i $CI_REGISTRY_IMAGE:latest - docker push $CI_REGISTRY_IMAGE:latest only: - master