Skip to content

Commit

Permalink
Merge pull request #23 from theohbrothers/fix/buildx-use-build-contai…
Browse files Browse the repository at this point in the history
…ner-os-and-arch-for-builds

Fix (buildx): Use build container `OS` and `ARCH` for builds
  • Loading branch information
leojonathanoh authored Dec 26, 2022
2 parents 7e05d17 + 095a5d4 commit 1b438d9
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 39 deletions.
4 changes: 1 addition & 3 deletions generate/templates/Dockerfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.7.0-alpine-3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.7.0-alpine-3.13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.7.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-alpine-3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-alpine-3.13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-alpine-3.15/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-alpine-3.17/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.15/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions variants/2.8.0-curl-git-jq-sops-ssh-alpine-3.17/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b438d9

Please sign in to comment.