From 095a5d4a22f37e4285cd01f8bb6b642b091cd515 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Mon, 26 Dec 2022 11:41:50 +0000 Subject: [PATCH] Fix (buildx): Use build container `OS` and `ARCH` for builds --- generate/templates/Dockerfile.ps1 | 4 +--- variants/2.7.0-alpine-3.12/Dockerfile | 4 +--- variants/2.7.0-alpine-3.13/Dockerfile | 4 +--- variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile | 4 +--- variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile | 4 +--- variants/2.8.0-alpine-3.12/Dockerfile | 4 +--- variants/2.8.0-alpine-3.13/Dockerfile | 4 +--- variants/2.8.0-alpine-3.15/Dockerfile | 4 +--- variants/2.8.0-alpine-3.17/Dockerfile | 4 +--- variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile | 4 +--- variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile | 4 +--- variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.15/Dockerfile | 4 +--- variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.17/Dockerfile | 4 +--- 13 files changed, 13 insertions(+), 39 deletions(-) diff --git a/generate/templates/Dockerfile.ps1 b/generate/templates/Dockerfile.ps1 index ece7fec..4dedd31 100644 --- a/generate/templates/Dockerfile.ps1 +++ b/generate/templates/Dockerfile.ps1 @@ -7,9 +7,7 @@ RUN echo "I am running on `$BUILDPLATFORM, building for `$TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch $( $VARIANT['_metadata']['package_version'] ) \ && cd /src \ - && OS="$( ($VARIANT['_metadata']['platforms'].split(',') | % { $_.split('/')[0] } | Select-Object -Unique ) -join ' ' )" \ - ARCH="$( ($VARIANT['_metadata']['platforms'].split(',') | % { $_.split('/')[1] } | Select-Object -Unique ) -join ' ' )" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM $( $VARIANT['_metadata']['distro'] ):$( $VARIANT['_metadata']['distro_version'] ) COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.7.0-alpine-3.12/Dockerfile b/variants/2.7.0-alpine-3.12/Dockerfile index 3db9e7f..5804cdb 100644 --- a/variants/2.7.0-alpine-3.12/Dockerfile +++ b/variants/2.7.0-alpine-3.12/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.7.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.12 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.7.0-alpine-3.13/Dockerfile b/variants/2.7.0-alpine-3.13/Dockerfile index 8389b3d..27d7773 100644 --- a/variants/2.7.0-alpine-3.13/Dockerfile +++ b/variants/2.7.0-alpine-3.13/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.7.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.13 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile b/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile index 86f1789..b7f35a6 100644 --- a/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile +++ b/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.7.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.12 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile b/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile index cd9277e..53cb1e3 100644 --- a/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile +++ b/variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.7.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.13 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-alpine-3.12/Dockerfile b/variants/2.8.0-alpine-3.12/Dockerfile index 2c2a044..81dde2a 100644 --- a/variants/2.8.0-alpine-3.12/Dockerfile +++ b/variants/2.8.0-alpine-3.12/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.12 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-alpine-3.13/Dockerfile b/variants/2.8.0-alpine-3.13/Dockerfile index 28e46e2..9fb2c14 100644 --- a/variants/2.8.0-alpine-3.13/Dockerfile +++ b/variants/2.8.0-alpine-3.13/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.13 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-alpine-3.15/Dockerfile b/variants/2.8.0-alpine-3.15/Dockerfile index 545c6f0..c890aba 100644 --- a/variants/2.8.0-alpine-3.15/Dockerfile +++ b/variants/2.8.0-alpine-3.15/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.15 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-alpine-3.17/Dockerfile b/variants/2.8.0-alpine-3.17/Dockerfile index 947f8b3..95beb2f 100644 --- a/variants/2.8.0-alpine-3.17/Dockerfile +++ b/variants/2.8.0-alpine-3.17/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.17 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile index b83663b..6d9f8ec 100644 --- a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile +++ b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.12 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile index 452ef7d..e9f4f69 100644 --- a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile +++ b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.13 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.15/Dockerfile b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.15/Dockerfile index 7bc35ff..78bec44 100644 --- a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.15/Dockerfile +++ b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.15/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.15 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook diff --git a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.17/Dockerfile b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.17/Dockerfile index 88948a1..e165296 100644 --- a/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.17/Dockerfile +++ b/variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.17/Dockerfile @@ -6,9 +6,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN apk add --no-cache git \ && git clone https://github.com/adnanh/webhook.git /src --branch 2.8.0 \ && cd /src \ - && OS="linux" \ - ARCH="386 amd64 arm arm64 s390x" \ - go build -ldflags="-s -w" -o /usr/local/bin/webhook + && go build -ldflags="-s -w" -o /usr/local/bin/webhook FROM alpine:3.17 COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook