forked from kaasops/config-reloader
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
29 lines (20 loc) · 823 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
FROM golang:1.23.5-alpine3.20@sha256:def59a601e724ddac5139d447e8e9f7d0aeec25db287a9ee1615134bcda266e2 AS builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY pkg pkg
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
RUN go mod tidy
# Copy the go source
COPY /cmd/configreloader/main.go main.go
# Build
RUN CGO_ENABLED=0 go build -a -o config-reloader main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:latest
WORKDIR /
COPY --from=builder /workspace/config-reloader .
ENTRYPOINT ["/config-reloader"]