-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathDockerfile.rhtap
33 lines (24 loc) · 992 Bytes
/
Dockerfile.rhtap
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
# Stage 1: Use image builder to build the target binaries
# Copyright Contributors to the Open Cluster Management project
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder
ENV COMPONENT=governance-policy-propagator
ENV REPO_PATH=/go/src/github.com/stolostron/${COMPONENT}
WORKDIR ${REPO_PATH}
COPY . .
RUN go mod vendor
RUN make build
# Stage 2: Copy the binaries from the image builder to the base image
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
ENV COMPONENT=governance-policy-propagator
ENV REPO_PATH=/go/src/github.com/stolostron/${COMPONENT}
ENV OPERATOR=/usr/local/bin/${COMPONENT} \
USER_UID=1001 \
USER_NAME=${COMPONENT}
# install operator binary
COPY --from=builder ${REPO_PATH}/build/_output/bin/${COMPONENT} ${OPERATOR}
COPY --from=builder ${REPO_PATH}/build/bin /usr/local/bin
RUN /usr/local/bin/user_setup
ENTRYPOINT ["/usr/local/bin/entrypoint"]
RUN microdnf update && \
microdnf clean all
USER ${USER_UID}