This commit is contained in:
parent
16cf5d8fe4
commit
1dbf1eb537
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
|
base_tag=$REGISTRY/$SERVICE
|
||||||
latest_tag="$REGISTRY/$SERVICE:latest"
|
tag="$base_tag:${COMMIT_SHA:0:10}"
|
||||||
|
latest_tag="$base_tag:latest"
|
||||||
|
|
||||||
if [[ -n $DEBUG ]]
|
if [[ -n $DEBUG ]]
|
||||||
then
|
then
|
||||||
@ -17,6 +18,25 @@ fi
|
|||||||
echo "docker: logging in"
|
echo "docker: logging in"
|
||||||
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||||
|
|
||||||
DOCKER_BUILDKIT=1 docker build -t "$tag" --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $latest_tag -f "$TMP/build_release.Dockerfile" .
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
|
function build_target {
|
||||||
|
target=$1
|
||||||
|
echo "building $target"
|
||||||
|
target_tag="$base_tag-$target:${COMMIT_SHA:0:10}"
|
||||||
|
latest_target_tag="$base_tag-$target:latest"
|
||||||
|
docker build \
|
||||||
|
--target "$target" \
|
||||||
|
--tag "$target_tag" \
|
||||||
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||||||
|
--cache-from $latest_tag \
|
||||||
|
--file "$TMP/build_release.Dockerfile" .
|
||||||
|
docker tag "$target_tag" "$latest_target_tag"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_target "deps"
|
||||||
|
build_target "builder"
|
||||||
|
|
||||||
|
docker build -t "$tag" --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $latest_tag -f "$TMP/build_release.Dockerfile" .
|
||||||
docker tag "$tag" "$latest_tag"
|
docker tag "$tag" "$latest_tag"
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
|
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
|
||||||
|
latest_tag="$REGISTRY/$SERVICE:latest"
|
||||||
|
|
||||||
if [[ -n $DEBUG ]]
|
if [[ -n $DEBUG ]]
|
||||||
then
|
then
|
||||||
@ -16,5 +17,18 @@ fi
|
|||||||
echo "docker: logging in"
|
echo "docker: logging in"
|
||||||
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||||
|
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
|
function build_target {
|
||||||
|
target=$1
|
||||||
|
echo "building $target"
|
||||||
|
latest_target_tag="$base_tag-$target:latest"
|
||||||
|
docker push "$latest_target_tag"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_target "deps"
|
||||||
|
build_target "builder"
|
||||||
|
|
||||||
echo "docker: pushing image $tag"
|
echo "docker: pushing image $tag"
|
||||||
DOCKER_BUILDKIT=1 docker push "$tag"
|
docker push "$tag"
|
||||||
|
docker push "$latest_tag"
|
||||||
|
Loading…
Reference in New Issue
Block a user