Use native Go cross-compilation
This commit is contained in:
parent
a2fd352bf1
commit
93852060cc
1 changed files with 9 additions and 5 deletions
14
Dockerfile
14
Dockerfile
|
|
@ -1,14 +1,18 @@
|
|||
FROM golang:alpine AS builder
|
||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
|
||||
|
||||
RUN apk add build-base
|
||||
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
|
||||
|
||||
COPY --from=xx / /
|
||||
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum .
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
WORKDIR /src/cmd/WatchYourLAN
|
||||
RUN CGO_ENABLED=0 go build -ldflags='-w -s' -o /WatchYourLAN .
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
RUN CGO_ENABLED=0 xx-go build -ldflags='-w -s' -o /WatchYourLAN ./cmd/WatchYourLAN
|
||||
|
||||
|
||||
FROM alpine
|
||||
|
|
|
|||
Loading…
Reference in a new issue