Skip to content

Commit

Permalink
Move Dockerfile to the build directory
Browse files Browse the repository at this point in the history
This prepares for a `Dockerfile` CI check in the framework.

Signed-off-by: Dale Haiducek <[email protected]>
  • Loading branch information
dhaiducek authored and openshift-merge-robot committed May 9, 2023
1 parent f4d8ced commit fc19946
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
33 changes: 0 additions & 33 deletions Dockerfile

This file was deleted.

1 change: 1 addition & 0 deletions Dockerfile
33 changes: 33 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit fc19946

Please sign in to comment.