mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-10 10:32:56 +01:00
It is cache-from
This commit is contained in:
parent
c393e4e804
commit
2269f81b22
2 changed files with 12 additions and 6 deletions
|
|
@ -38,13 +38,16 @@ variables:
|
||||||
# http://unix.stackexchange.com/a/137571
|
# http://unix.stackexchange.com/a/137571
|
||||||
- set -- $CI_JOB_NAME
|
- set -- $CI_JOB_NAME
|
||||||
- docker pull "$CI_REGISTRY_IMAGE:$1" || true
|
- docker pull "$CI_REGISTRY_IMAGE:$1" || true
|
||||||
- docker build --from-cache="$CI_REGISTRY_IMAGE:$1" -f "Dockerfile.$1" .
|
- docker build --cache-from="$CI_REGISTRY_IMAGE:$1" -f "Dockerfile.$1" .
|
||||||
|
|
||||||
.build_and_deploy: &build_and_deploy
|
.build_and_deploy: &build_and_deploy
|
||||||
extends: .build
|
extends: .build
|
||||||
script:
|
script:
|
||||||
|
# Hack to set an array in /bin/sh
|
||||||
|
# http://unix.stackexchange.com/a/137571
|
||||||
|
- set -- $CI_JOB_NAME
|
||||||
- docker pull "$CI_REGISTRY_IMAGE:$1" || true
|
- docker pull "$CI_REGISTRY_IMAGE:$1" || true
|
||||||
- docker build --from-cache="$CI_REGISTRY_IMAGE:$1" --label "ci_pipeline_url=$CI_PIPELINE_URL" --label "ci_job_url=$CI_JOB_URL" -t "$CI_REGISTRY_IMAGE:$CI_JOB_NAME" -f "Dockerfile.$CI_JOB_NAME" .
|
- docker build --cache-from="$CI_REGISTRY_IMAGE:$1" --label "ci_pipeline_url=$CI_PIPELINE_URL" --label "ci_job_url=$CI_JOB_URL" -t "$CI_REGISTRY_IMAGE:$1" -f "Dockerfile.$1" .
|
||||||
- docker push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
- docker push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
||||||
|
|
||||||
.test_custom: &test_custom
|
.test_custom: &test_custom
|
||||||
|
|
@ -53,15 +56,18 @@ variables:
|
||||||
# Hack to set an array in /bin/sh
|
# Hack to set an array in /bin/sh
|
||||||
# http://unix.stackexchange.com/a/137571
|
# http://unix.stackexchange.com/a/137571
|
||||||
- set -- $CI_JOB_NAME
|
- set -- $CI_JOB_NAME
|
||||||
- ./scripts/custom-docker-build $1
|
- ./scripts/custom-docker-build "$1"
|
||||||
rules:
|
rules:
|
||||||
- when: always
|
- when: always
|
||||||
|
|
||||||
.build_and_deploy_custom: &build_and_deploy_custom
|
.build_and_deploy_custom: &build_and_deploy_custom
|
||||||
extends: .build
|
extends: .build
|
||||||
script:
|
script:
|
||||||
- ./scripts/custom-docker-build $CI_JOB_NAME --label "ci_pipeline_url=$CI_PIPELINE_URL" --label "ci_job_url=$CI_JOB_URL" -t "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
# Hack to set an array in /bin/sh
|
||||||
- docker push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
|
# http://unix.stackexchange.com/a/137571
|
||||||
|
- set -- $CI_JOB_NAME
|
||||||
|
- ./scripts/custom-docker-build "$1" --label "ci_pipeline_url=$CI_PIPELINE_URL" --label "ci_job_url=$CI_JOB_URL" -t "$CI_REGISTRY_IMAGE:$1"
|
||||||
|
- docker push "$CI_REGISTRY_IMAGE:$1"
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ function build_custom_if_needed() {
|
||||||
|
|
||||||
# This re-uses and builds an existing image if needed
|
# This re-uses and builds an existing image if needed
|
||||||
docker pull "$full_image" || true
|
docker pull "$full_image" || true
|
||||||
docker_command=$(generate_command $@ --from-cache="$full_image_name" )
|
docker_command=$(generate_command $@ --cache-from="$full_image_name" )
|
||||||
echo "Building $build_image_name with $docker_command"
|
echo "Building $build_image_name with $docker_command"
|
||||||
eval $docker_command
|
eval $docker_command
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue