From 156b5828740051c8304f0c5f751daaa1b867ffc2 Mon Sep 17 00:00:00 2001 From: kaznak Date: Thu, 14 Dec 2023 15:58:24 +0900 Subject: [PATCH] fix --- .github/generate-strategy.sh | 23 +++++++++++++---------- .github/workflows/build.yml | 8 ++++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/generate-strategy.sh b/.github/generate-strategy.sh index e3fd701..3672ba6 100755 --- a/.github/generate-strategy.sh +++ b/.github/generate-strategy.sh @@ -14,33 +14,36 @@ repository_with_trailing_slash=$1 jq ' . as $root | { - dir: ($root.dir // $root.imgname + "/" + $root.variant), - imgtags: ($root.imgtags // [$root.variant]) + dir: ($root.imgname + "/" + $root.variant), + imgtags: [$root.variant] } as $tmp | { - platforms: ($root.platforms // ["linux/amd64"]), imgtags: $tmp.imgtags, - tags: ($tmp.imgtags | map("'$repository_with_trailing_slash'\($root.imgname):\(.)")), + tags: (($root.imgtags // $tmp.imgtags) | map("'$repository_with_trailing_slash'\($root.imgname):\(.)")), + platforms: ($root.platforms // ["linux/amd64"]), dir: $tmp.dir, files: { - dockerfile: ($tmp.dir + "/Dockerfile"), - dockleignore: ($tmp.dir + "/.dockleignore") + dockerfile: "Dockerfile", + dockleignore: ".dockleignore" }, buildArgs: {} } as $defaults | -.platforms // $defaults.platforms | .[] | . as $platform | { name: $root.name, - variant: $root.variant, - platform: $platform, imgname: $root.imgname, - imgtags: $defaults.imgtags, + variant: $root.variant, + imgtags: ($root.imgtags // $defaults.imgtags), tags: ($root.tags // $defaults.tags), + platforms: ($root.platforms // $defaults.platforms), dir: ($root.dir // $defaults.dir), files: { dockerfile: ($root.files.dockerfile // $defaults.files.dockerfile), dockleignore: ($root.files.dockleignore // $defaults.files.dockleignore) }, + filesProcessed: { + dockerfile: (($root.dir // $defaults.dir) + "/" + ($root.files.dockerfile // $defaults.files.dockerfile)), + dockleignore: (($root.dir // $defaults.dir) + "/" + ($root.files.dockleignore // $defaults.files.dockleignore)) + }, buildArgs: ($root.buildArgs // $defaults.buildArgs), buildArgsProcessed: (($root.buildArgs // $defaults.buildArgs) | to_entries | map("\(.key)=\(.value)") | join("\n")) } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c57782a..55e4df3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,7 +64,7 @@ jobs: uses: docker/build-push-action@v5 with: context: ${{ matrix.dir }} - file: ${{ matrix.file }} + file: ${{ matrix.filesProcessed }} push: false load: true tags: ${{ join(matrix.tags) }} @@ -72,7 +72,7 @@ jobs: - name: Setup dockle env: - dockleignore: ${{ matrix.files.dockleignore }} + dockleignore: ${{ matrix.filesProcessed.dockleignore }} run: | cp $dockleignore . @@ -89,8 +89,8 @@ jobs: uses: docker/build-push-action@v5 with: context: ${{ matrix.dir }} - file: ${{ matrix.files.dockerfile }} - platforms: ${{ matrix.platforms }} + file: ${{ matrix.filesProcessed.dockerfile }} + platforms: ${{ join(matrix.platforms) }} push: true tags: ${{ join(matrix.tags) }} build-args: ${{ matrix.buildArgsProcessed }}