use caching within docker build
@@ -2,9 +2,10 @@ variables:
EXTERNAL_GIT_DIR: "/external-git"
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
+ CONTAINER_IMAGE: registry.gitlab.com/pymedphys/pymedphys/ci
test:
- image: registry.gitlab.com/pymedphys/pymedphys/ci:latest
+ image: $CONTAINER_IMAGE:latest
script:
- mkdir $EXTERNAL_GIT_DIR
- CI_DIR=$PWD
@@ -25,7 +26,7 @@ ci-docker-build:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- - docker build -t registry.gitlab.com/pymedphys/pymedphys/ci ./scripts/gitlab-ci
- - docker push registry.gitlab.com/pymedphys/pymedphys/ci
- only:
- - master
+ - docker pull $CONTAINER_IMAGE:latest || true
+ - docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest ./scripts/gitlab-ci
+ - docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
+ - docker push $CONTAINER_IMAGE:latest
