forked from openshift-kni/lifecycle-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (38 loc) · 1.73 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
41
42
43
44
45
46
47
48
49
#####################################################################################################
# Build the binaries
FROM registry.access.redhat.com/ubi9/go-toolset:1.22.5-1730550521 as builder
# Bring in the go dependencies before anything else so we can take
# advantage of caching these layers in future builds.
COPY vendor/ vendor/
# Copy the go modules manifests
COPY go.* .
# Copy the required source directories
COPY api api
COPY controllers controllers
COPY lca-cli lca-cli
COPY internal internal
COPY main main
COPY utils utils
# Build the binaries
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor -a -o build/manager main/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor -a -o build/lca-cli main/lca-cli/main.go
#####################################################################################################
# Build the operator image
# note: update origin-cli-artifacts from `latest` to an appropriate OCP verison during release e.g `4.18`
FROM quay.io/openshift/origin-cli-artifacts:latest AS origincli
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
RUN if [[ ! -f /bin/nsenter ]]; then \
microdnf -y install util-linux-core && \
microdnf -y install rsync && \
microdnf -y install tar && \
microdnf clean all && \
rm -rf /var/cache/yum ; \
fi
COPY --from=builder \
/opt/app-root/src/build/manager \
/opt/app-root/src/build/lca-cli \
/usr/local/bin/
COPY lca-cli/installation_configuration_files/ /usr/local/installation_configuration_files/
COPY --from=origincli /usr/share/openshift/linux_amd64/oc.rhel9 /usr/bin/oc
COPY must-gather/collection-scripts/ /usr/bin/
ENTRYPOINT ["/usr/local/bin/manager"]