-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 845 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (25 loc) · 845 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
31
32
33
34
# stage 1: build static binary
FROM golang:1.24-alpine AS build
RUN apk add --no-cache ca-certificates git
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
ARG COMMIT=none
ARG BUILD_TIME=unknown
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-trimpath \
-ldflags="-s -w -buildid= \
-X dispatch/internal/version.Version=${VERSION} \
-X dispatch/internal/version.Commit=${COMMIT} \
-X dispatch/internal/version.BuildTime=${BUILD_TIME}" \
-o /out/dispatch ./cmd/dispatch
# stage 2: minimal runtime
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /out/dispatch /dispatch
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
EXPOSE 18087
ENTRYPOINT ["/dispatch"]
CMD ["--config", "/config/router.yaml"]