forked from angelnu/gateway-admision-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 904 Bytes
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 904 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
FROM golang:1.21@sha256:672a2286da3ee7a854c3e0a56e0838918d0dbb1c18652992930293312de898a6 AS build
WORKDIR /workspace
ENV GO111MODULE=on
COPY *.go go.mod *.sum ./
# Download
RUN go mod download
# Bulild
COPY cmd ./cmd
COPY internal ./internal
RUN CGO_ENABLED=0 go build -o app -ldflags '-w -extldflags "-static"' ./cmd
#Test
RUN CCGO_ENABLED=0 go test -v ./...
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
# debug tag adds a shell (not recommended for prod)
FROM gcr.io/distroless/static:nonroot@sha256:112a87f19e83c83711cc81ce8ed0b4d79acd65789682a6a272df57c4a0858534
WORKDIR /
COPY --from=build /workspace/app /app/app
USER nonroot:nonroot
ENTRYPOINT ["/app/app"]
ARG IMAGE_SOURCE
#https://github.com/k8s-at-home/template-container-image
LABEL org.opencontainers.image.source $IMAGE_SOURCE