Skip to content

Commit

Permalink
Fix multiarch docker builds (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
AverageMarcus committed Aug 19, 2020
1 parent 543a25c commit 8d298c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} tonistiigi/xx:golang AS xgo
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14-alpine AS builder
COPY --from=xgo / /
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14 as builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH

WORKDIR /app/
ADD . .
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o kube-image-prefetch main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o kube-image-prefetch main.go

FROM --platform=${TARGETPLATFORM:-linux/amd64} scratch
WORKDIR /app/
Expand Down

0 comments on commit 8d298c2

Please sign in to comment.