-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 707 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (25 loc) · 707 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
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.26
ARG GO_BUILD_TAGS=cloud
FROM golang:${GO_VERSION}-bookworm AS build
ARG GO_BUILD_TAGS=cloud
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build \
-tags="${GO_BUILD_TAGS}" \
-trimpath \
-ldflags="-s -w" \
-o /out/vouch \
./cmd/vouch
RUN mkdir -p /out/cache
FROM gcr.io/distroless/static-debian12:nonroot AS runtime
WORKDIR /app
COPY --from=build /out/vouch /vouch
COPY --from=build --chown=nonroot:nonroot /out/cache /app/.cache
COPY deploy/docker/config.yaml /etc/vouch/config.yaml
EXPOSE 18080
USER nonroot:nonroot
ENTRYPOINT ["/vouch"]
CMD ["-config", "/etc/vouch/config.yaml"]