add cross-compile

This commit is contained in:
Noah 2024-12-22 03:52:10 +01:00
parent 453f03d832
commit 96db61831c
2 changed files with 8 additions and 8 deletions

View file

@ -1,12 +1,15 @@
FROM golang:alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.23.4-alpine AS builder
WORKDIR /steamsalty
RUN apk update && apk add --no-cache ca-certificates
COPY . .
COPY go.mod go.sum ./
RUN go mod download
RUN go build -o /app/steamsalty
COPY . .
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/steamsalty
@ -18,4 +21,4 @@ COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /app/steamsalty /app/steamsalty
ENTRYPOINT ["/app/steamsalty"]
ENTRYPOINT ["/app/steamsalty"]