-
Notifications
You must be signed in to change notification settings - Fork 61
/
Dockerfile
40 lines (29 loc) · 1.04 KB
/
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
FROM registry.access.redhat.com/ubi8/go-toolset:1.21.11-8.1724662611 as builder
USER 0
ENV GOSUMDB=off
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# 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
COPY Makefile Makefile
COPY hack/boilerplate.go.txt hack/boilerplate.go.txt
# Copy the go source
COPY main.go main.go
COPY config/ config/
COPY apis/ apis/
COPY controllers/ controllers/
RUN make manifests generate fmt vet release
# Build
RUN CGO_ENABLED=1 GOOS=linux GO111MODULE=on go build -o manager main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10-1086
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/manifest.yaml .
COPY jsons ./jsons/
USER 65534:65534
ENTRYPOINT ["/manager"]