Skip to content

Commit

Permalink
Use go cross compilation for faster build (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughns authored Jan 20, 2025
1 parent 188c9a7 commit 673d744
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,6 +1,6 @@
ARG GO_VERSION="build-arg-must-be-provided"

FROM golang:${GO_VERSION}-alpine AS builder
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS builder

WORKDIR /proj

Expand All @@ -10,7 +10,8 @@ RUN go mod download

COPY *.go ./

RUN go build -o lk-jwt-service
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o lk-jwt-service

FROM scratch

Expand Down

0 comments on commit 673d744

Please sign in to comment.