From fc199469076dadfb99c0f191923c1470258477ce Mon Sep 17 00:00:00 2001 From: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com> Date: Tue, 9 May 2023 15:04:20 -0400 Subject: [PATCH] Move Dockerfile to the build directory This prepares for a `Dockerfile` CI check in the framework. Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com> --- Dockerfile | 34 +--------------------------------- build/Dockerfile | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 33 deletions(-) mode change 100644 => 120000 Dockerfile create mode 100644 build/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ae1bcc66..00000000 --- a/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright Contributors to the Open Cluster Management project - -# Stage 1: Use image builder to build the target binaries -FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS builder - -ENV COMPONENT=cert-policy-controller -ENV REPO_PATH=/go/src/github.com/stolostron/${COMPONENT} -WORKDIR ${REPO_PATH} -COPY . . -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=cert-policy-controller -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 - -RUN microdnf update && \ - microdnf install shadow-utils procps && \ - microdnf clean all - -ENTRYPOINT ["/usr/local/bin/entrypoint"] - -USER ${USER_UID} diff --git a/Dockerfile b/Dockerfile new file mode 120000 index 00000000..452ad86c --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +./build/Dockerfile \ No newline at end of file diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 00000000..ae1bcc66 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,33 @@ +# Copyright Contributors to the Open Cluster Management project + +# Stage 1: Use image builder to build the target binaries +FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS builder + +ENV COMPONENT=cert-policy-controller +ENV REPO_PATH=/go/src/github.com/stolostron/${COMPONENT} +WORKDIR ${REPO_PATH} +COPY . . +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=cert-policy-controller +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 + +RUN microdnf update && \ + microdnf install shadow-utils procps && \ + microdnf clean all + +ENTRYPOINT ["/usr/local/bin/entrypoint"] + +USER ${USER_UID}