Improve caching for the build step

This commit is contained in:
ErickSkrauch 2019-08-03 22:10:29 +03:00
parent d333798919
commit 663cfd9dbc

View File

@ -5,7 +5,7 @@ stages:
- cleanup - cleanup
.defineVersion: &defineVersion |- .defineVersion: &defineVersion |-
export VERSION="${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}}" export VERSION="${CI_COMMIT_TAG:-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA:0:7}}"
.loginIntoRegistry: &loginIntoRegistry |- .loginIntoRegistry: &loginIntoRegistry |-
docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by
@ -82,6 +82,7 @@ build:production:
--pull --pull
--target web --target web
--build-arg "build_env=prod" --build-arg "build_env=prod"
--cache-from "$APP_IMAGE_NAME:latest"
--cache-from "$WEB_IMAGE_NAME:latest" --cache-from "$WEB_IMAGE_NAME:latest"
-t "$WEB_IMAGE_NAME:$CI_PIPELINE_ID" . -t "$WEB_IMAGE_NAME:$CI_PIPELINE_ID" .
- > - >
@ -89,6 +90,7 @@ build:production:
--pull --pull
--target db --target db
--build-arg "build_env=prod" --build-arg "build_env=prod"
--cache-from "$APP_IMAGE_NAME:latest"
--cache-from "$DB_IMAGE_NAME:latest" --cache-from "$DB_IMAGE_NAME:latest"
-t "$DB_IMAGE_NAME:$CI_PIPELINE_ID" . -t "$DB_IMAGE_NAME:$CI_PIPELINE_ID" .
only: only: