-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
46 lines (23 loc) · 922 Bytes
/
Dockerfile
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
35
36
37
38
39
40
41
42
43
44
45
46
FROM golang:1.23 AS base
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
FROM base AS test-unit
COPY internal/ ./internal
RUN mkdir ./coverage
VOLUME ./coverage
CMD ["go", "test", "-v", "-race", "-covermode=atomic", "-coverprofile=./coverage/coverage.out", "./..."]
FROM base AS test-e2e
COPY e2e ./e2e
CMD ["go", "test", "-v", "--tags", "e2e", "./..."]
FROM base AS build
COPY cmd/ ./cmd
COPY internal/ ./internal
RUN CGO_ENABLED=0 GOOS=linux go build -o ./tmp/local-jwks-server cmd/server/server.go
RUN CGO_ENABLED=0 GOOS=linux go build -o ./tmp/health cmd/health/health.go
FROM gcr.io/distroless/base-debian12:nonroot AS app
COPY --from=build /app/tmp/local-jwks-server /usr/bin/local-jwks-server
COPY --from=build /app/tmp/health /usr/bin/health
USER nonroot:nonroot
HEALTHCHECK --interval=5s --timeout=30s --retries=10 CMD [ "/usr/bin/health" ]
ENTRYPOINT ["/usr/bin/local-jwks-server"]