diff --git a/.tekton/governance-policy-propagator-fm3n-pull-request.yaml b/.tekton/governance-policy-propagator-fm3n-pull-request.yaml index 23ec9aa5..ee7a62d6 100644 --- a/.tekton/governance-policy-propagator-fm3n-pull-request.yaml +++ b/.tekton/governance-policy-propagator-fm3n-pull-request.yaml @@ -19,7 +19,7 @@ metadata: spec: params: - name: dockerfile - value: ./Dockerfile + value: ./Dockerfile.rhtap - name: git-url value: '{{repo_url}}' - name: image-expires-after diff --git a/.tekton/governance-policy-propagator-fm3n-push.yaml b/.tekton/governance-policy-propagator-fm3n-push.yaml index 74bef94d..960c779b 100644 --- a/.tekton/governance-policy-propagator-fm3n-push.yaml +++ b/.tekton/governance-policy-propagator-fm3n-push.yaml @@ -18,7 +18,7 @@ metadata: spec: params: - name: dockerfile - value: ./Dockerfile + value: ./Dockerfile.rhtap - name: git-url value: '{{repo_url}}' - name: output-image diff --git a/Dockerfile.rhtap b/Dockerfile.rhtap new file mode 100644 index 00000000..636c173b --- /dev/null +++ b/Dockerfile.rhtap @@ -0,0 +1,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}