split stable & edge builds, for parallelization & avoiding failures in one to prevent the other images to build
This commit is contained in:
parent
bcedf56664
commit
76234b4a1e
2 changed files with 16 additions and 9 deletions
7
.github/workflows/build-images.yml
vendored
7
.github/workflows/build-images.yml
vendored
|
@ -12,6 +12,11 @@ on:
|
|||
jobs:
|
||||
buildx:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: [stable, edge]
|
||||
name: Build images based on ${{ matrix.image }} Alpine release
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
@ -27,4 +32,4 @@ jobs:
|
|||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: ./buildx.sh ${{ github.event_name }}
|
||||
run: ./buildx.sh ${{ github.event_name }} ${{ matrix.image }}
|
||||
|
|
18
buildx.sh
18
buildx.sh
|
@ -5,6 +5,8 @@
|
|||
set -euxo pipefail
|
||||
|
||||
EVENT=$1
|
||||
EDGE=false
|
||||
[ "$2" = edge ] && EDGE=true
|
||||
|
||||
build_image() {
|
||||
local PUSH
|
||||
|
@ -59,15 +61,15 @@ main() {
|
|||
PUSH=false
|
||||
fi
|
||||
|
||||
if [ "$EDGE" = true ] ; then
|
||||
sed -e 's/^FROM alpine:.*$/FROM alpine:edge/' Dockerfile > Dockerfile.edge
|
||||
fi
|
||||
image_build_arguments | while read -r IMAGE BUILD_ARGS ; do
|
||||
build_image $PUSH --tag "$IMAGE:latest" --tag "$IMAGE:$TAG" --tag "${IMAGE}:${TAG%%-*}" "$BUILD_ARGS"
|
||||
done
|
||||
|
||||
# run the edge builds in a separate loop, to avoid issues in them from
|
||||
# preventing the stable image builds and pushes to conclude
|
||||
sed -e 's/^FROM alpine:.*$/FROM alpine:edge/' Dockerfile > Dockerfile.edge
|
||||
image_build_arguments | while read -r IMAGE BUILD_ARGS ; do
|
||||
build_image $PUSH -f Dockerfile.edge --tag "$IMAGE:edge" "$BUILD_ARGS"
|
||||
if [ "$EDGE" = false ] ; then
|
||||
build_image $PUSH --tag "$IMAGE:latest" --tag "$IMAGE:$TAG" --tag "${IMAGE}:${TAG%%-*}" "$BUILD_ARGS"
|
||||
else
|
||||
build_image $PUSH -f Dockerfile.edge --tag "$IMAGE:edge" "$BUILD_ARGS"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f Dockerfile.edge "$HOME/.docker/config.json"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue