-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (25 loc) · 757 Bytes
/
Dockerfile
File metadata and controls
30 lines (25 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# build
FROM golang:1.26.2-alpine AS build
WORKDIR /out
WORKDIR /src
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=bind,source=go.sum,destination=go.sum \
--mount=type=bind,source=go.mod,destination=go.mod \
go mod download
ARG TARGETOS
ARG TARGETARCH
ARG SOURCE_DATE_EPOCH=0
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=bind,source=. \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build \
-trimpath -buildvcs=false -ldflags="-s -w" \
-o /out ./...
# binary
FROM scratch AS binary
COPY --from=build /out/* /
# final
FROM alpine:latest AS final
RUN apk add chntpw
COPY --from=build /out/linkwinbt /linkwinbt
ENTRYPOINT ["/linkwinbt"]