Skip to content

Commit

Permalink
use xx-info for multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasferrandiz committed Nov 27, 2023
1 parent 11e546b commit a4116fc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Dockerfile.image
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx

FROM --platform=$BUILDPLATFORM golang:alpine AS build
# copy xx scripts to your build stage
COPY --from=xx / /
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log
RUN xx-info env
RUN export GOOS=$(xx-info os) &&\
export GOARCH=$(xx-info arch) &&\
make vendor &&\
scripts/build_flannel.sh &&\
mv dist-dist/flannel-${GOARCH} /flannel

FROM alpine
COPY --from=build /log /log
ARG GOARCH
COPY --from=build /flannel /flannel

0 comments on commit a4116fc

Please sign in to comment.