Skip to content

Commit

Permalink
Dockerfile: cross compile images using native builder
Browse files Browse the repository at this point in the history
Use a build image built for the native architecture so that it doesn't
run in emulation mode.

Switch to Chainguard's wolfi/glibc build image. This limits our build
architectures to just amd64 and arm64, but that is sufficient for our
needs.

Updates #42
Updates #43

Signed-off-by: Will Norris <[email protected]>
  • Loading branch information
willnorris committed Jan 10, 2023
1 parent ef7f8b2 commit 706efd5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM cgr.dev/chainguard/go:1.19-musl as build
FROM --platform=$BUILDPLATFORM cgr.dev/chainguard/go:1.19 as build

WORKDIR /work

COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -v ./cmd/golink
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -v ./cmd/golink


FROM cgr.dev/chainguard/static:latest
Expand Down

0 comments on commit 706efd5

Please sign in to comment.