You've already forked speedtest-go
Faster multi stage build using cross compilation (#72)
Co-authored-by: maddie <maddie@users.noreply.github.com>
This commit is contained in:
+4
-2
@@ -1,11 +1,13 @@
|
||||
FROM golang:1.18-alpine AS build_base
|
||||
FROM --platform=$BUILDPLATFORM golang:1.18-alpine AS build_base
|
||||
RUN apk add --no-cache git gcc ca-certificates libc-dev
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY ./ ./
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
RUN go build -ldflags "-w -s" -trimpath -o speedtest .
|
||||
ARG TARGETOS TARGETARCH
|
||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -trimpath -buildvcs=false -o speedtest .
|
||||
|
||||
FROM scratch
|
||||
WORKDIR /app
|
||||
|
||||
Reference in New Issue
Block a user