Remove missing platforms tags

This commit is contained in:
Pau Rodriguez-Estivill
2022-02-26 13:42:41 +01:00
parent ae991f698b
commit 888459f6ec
2 changed files with 52 additions and 20 deletions
+12 -7
View File
@@ -6,23 +6,19 @@ variable "BUILDREV" {
default = "" default = ""
} }
target "common" {
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"GOCRONVER" = "v0.0.10"}
}
target "debian" { target "debian" {
inherits = ["common"] args = {"GOCRONVER" = "v0.0.10"}
dockerfile = "debian.Dockerfile" dockerfile = "debian.Dockerfile"
} }
target "alpine" { target "alpine" {
inherits = ["common"] args = {"GOCRONVER" = "v0.0.10"}
dockerfile = "alpine.Dockerfile" dockerfile = "alpine.Dockerfile"
} }
target "debian-latest" { target "debian-latest" {
inherits = ["debian"] inherits = ["debian"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "14"} args = {"BASETAG" = "14"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:latest", "prodrigestivill/postgres-backup-local:latest",
@@ -33,6 +29,7 @@ target "debian-latest" {
target "alpine-latest" { target "alpine-latest" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "14-alpine"} args = {"BASETAG" = "14-alpine"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:alpine", "prodrigestivill/postgres-backup-local:alpine",
@@ -43,6 +40,7 @@ target "alpine-latest" {
target "debian-13" { target "debian-13" {
inherits = ["debian"] inherits = ["debian"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "13"} args = {"BASETAG" = "13"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:13", "prodrigestivill/postgres-backup-local:13",
@@ -52,6 +50,7 @@ target "debian-13" {
target "alpine-13" { target "alpine-13" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "13-alpine"} args = {"BASETAG" = "13-alpine"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:13-alpine", "prodrigestivill/postgres-backup-local:13-alpine",
@@ -61,6 +60,7 @@ target "alpine-13" {
target "debian-12" { target "debian-12" {
inherits = ["debian"] inherits = ["debian"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "12"} args = {"BASETAG" = "12"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:12", "prodrigestivill/postgres-backup-local:12",
@@ -70,6 +70,7 @@ target "debian-12" {
target "alpine-12" { target "alpine-12" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "12-alpine"} args = {"BASETAG" = "12-alpine"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:12-alpine", "prodrigestivill/postgres-backup-local:12-alpine",
@@ -79,6 +80,7 @@ target "alpine-12" {
target "debian-11" { target "debian-11" {
inherits = ["debian"] inherits = ["debian"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"]
args = {"BASETAG" = "11"} args = {"BASETAG" = "11"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:11", "prodrigestivill/postgres-backup-local:11",
@@ -88,6 +90,7 @@ target "debian-11" {
target "alpine-11" { target "alpine-11" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "11-alpine"} args = {"BASETAG" = "11-alpine"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:11-alpine", "prodrigestivill/postgres-backup-local:11-alpine",
@@ -97,6 +100,7 @@ target "alpine-11" {
target "debian-10" { target "debian-10" {
inherits = ["debian"] inherits = ["debian"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"]
args = {"BASETAG" = "10"} args = {"BASETAG" = "10"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:10", "prodrigestivill/postgres-backup-local:10",
@@ -106,6 +110,7 @@ target "debian-10" {
target "alpine-10" { target "alpine-10" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x", "linux/ppc64le"]
args = {"BASETAG" = "10-alpine"} args = {"BASETAG" = "10-alpine"}
tags = [ tags = [
"prodrigestivill/postgres-backup-local:10-alpine", "prodrigestivill/postgres-backup-local:10-alpine",
+40 -13
View File
@@ -3,18 +3,22 @@
set -e set -e
DOCKER_BAKE_FILE=${1:-"docker-bake.hcl"} DOCKER_BAKE_FILE=${1:-"docker-bake.hcl"}
TAGS=${TAGS:-"14 13 12 11 10"}
GOCRONVER=${GOCRONVER:-"v0.0.10"}
PLATFORMS=${PLATFORMS:-"linux/amd64 linux/arm64 linux/arm/v7 linux/s390x linux/ppc64le"}
IMAGE_NAME=${IMAGE_NAME:-"prodrigestivill/postgres-backup-local"} IMAGE_NAME=${IMAGE_NAME:-"prodrigestivill/postgres-backup-local"}
GOCRONVER="v0.0.10"
MAIN_TAG="14"
TAGS_EXTRA="13 12"
PLATFORMS="linux/amd64 linux/arm64 linux/arm/v7 linux/s390x linux/ppc64le"
TAGS_EXTRA_2="11 10"
PLATFORMS_DEBIAN_2="linux/amd64 linux/arm64 linux/arm/v7"
cd "$(dirname "$0")" cd "$(dirname "$0")"
MAIN_TAG=${TAGS%%" "*} # First tag
TAGS_EXTRA=${TAGS#*" "} # Rest of tags
P="\"$(echo $PLATFORMS | sed 's/ /", "/g')\"" P="\"$(echo $PLATFORMS | sed 's/ /", "/g')\""
P2="\"$(echo $PLATFORMS_DEBIAN_2 | sed 's/ /", "/g')\""
T="\"debian-latest\", \"alpine-latest\", \"$(echo debian-$TAGS_EXTRA | sed 's/ /", "debian-/g')\", \"$(echo alpine-$TAGS_EXTRA | sed 's/ /", "alpine-/g')\"" T="\"debian-latest\", \"alpine-latest\", \"$(echo debian-$TAGS_EXTRA $TAGS_EXTRA_2 | sed 's/ /", "debian-/g')\", \"$(echo alpine-$TAGS_EXTRA $TAGS_EXTRA_2 | sed 's/ /", "alpine-/g')\""
cat > "$DOCKER_BAKE_FILE" << EOF cat > "$DOCKER_BAKE_FILE" << EOF
group "default" { group "default" {
@@ -25,23 +29,19 @@ variable "BUILDREV" {
default = "" default = ""
} }
target "common" {
platforms = [$P]
args = {"GOCRONVER" = "$GOCRONVER"}
}
target "debian" { target "debian" {
inherits = ["common"] args = {"GOCRONVER" = "$GOCRONVER"}
dockerfile = "debian.Dockerfile" dockerfile = "debian.Dockerfile"
} }
target "alpine" { target "alpine" {
inherits = ["common"] args = {"GOCRONVER" = "$GOCRONVER"}
dockerfile = "alpine.Dockerfile" dockerfile = "alpine.Dockerfile"
} }
target "debian-latest" { target "debian-latest" {
inherits = ["debian"] inherits = ["debian"]
platforms = [$P]
args = {"BASETAG" = "$MAIN_TAG"} args = {"BASETAG" = "$MAIN_TAG"}
tags = [ tags = [
"$IMAGE_NAME:latest", "$IMAGE_NAME:latest",
@@ -52,6 +52,7 @@ target "debian-latest" {
target "alpine-latest" { target "alpine-latest" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = [$P]
args = {"BASETAG" = "$MAIN_TAG-alpine"} args = {"BASETAG" = "$MAIN_TAG-alpine"}
tags = [ tags = [
"$IMAGE_NAME:alpine", "$IMAGE_NAME:alpine",
@@ -65,6 +66,7 @@ for TAG in $TAGS_EXTRA; do cat >> "$DOCKER_BAKE_FILE" << EOF
target "debian-$TAG" { target "debian-$TAG" {
inherits = ["debian"] inherits = ["debian"]
platforms = [$P]
args = {"BASETAG" = "$TAG"} args = {"BASETAG" = "$TAG"}
tags = [ tags = [
"$IMAGE_NAME:$TAG", "$IMAGE_NAME:$TAG",
@@ -74,6 +76,31 @@ target "debian-$TAG" {
target "alpine-$TAG" { target "alpine-$TAG" {
inherits = ["alpine"] inherits = ["alpine"]
platforms = [$P]
args = {"BASETAG" = "$TAG-alpine"}
tags = [
"$IMAGE_NAME:$TAG-alpine",
notequal("", BUILDREV) ? "$IMAGE_NAME:$TAG-alpine-\${BUILDREV}" : ""
]
}
EOF
done
for TAG in $TAGS_EXTRA_2; do cat >> "$DOCKER_BAKE_FILE" << EOF
target "debian-$TAG" {
inherits = ["debian"]
platforms = [$P2]
args = {"BASETAG" = "$TAG"}
tags = [
"$IMAGE_NAME:$TAG",
notequal("", BUILDREV) ? "$IMAGE_NAME:$TAG-debian-\${BUILDREV}" : ""
]
}
target "alpine-$TAG" {
inherits = ["alpine"]
platforms = [$P]
args = {"BASETAG" = "$TAG-alpine"} args = {"BASETAG" = "$TAG-alpine"}
tags = [ tags = [
"$IMAGE_NAME:$TAG-alpine", "$IMAGE_NAME:$TAG-alpine",