openshift-knative / hack

CI tooling to improve and automate CI and release management
Apache License 2.0
4 stars 16 forks source link

Use production-ready Dockerfile template for Go images #220

Closed mgencur closed 2 months ago

mgencur commented 2 months ago

Related to https://issues.redhat.com/browse/SRVCOM-3255

FROM $GO_BUILDER as builder

COPY . .

ENV CGO_ENABLED=1 ENV GOEXPERIMENT=strictfipsruntime

RUN go build -tags strictfipsruntime -o /usr/bin/main ./cmd/apiserver_receive_adapter

FROM $UBI8_MINIMAL

Install the missing zoneinfo to ubi-minimal

RUN microdnf install tzdata

USER 65532

COPY --from=builder /usr/bin/main /usr/bin/main

LABEL \ com.redhat.component="openshift-serverless-1-eventing-apiserver-receive-adapter-rhel8-container" \ name="openshift-serverless-1/eventing-apiserver-receive-adapter-rhel8" \ version="$VERSION" \ summary="Red Hat OpenShift Serverless 1 Eventing Apiserver Receive Adapter" \ maintainer="serverless-support@redhat.com" \ description="Red Hat OpenShift Serverless 1 Eventing Apiserver Receive Adapter" \ io.k8s.display-name="Red Hat OpenShift Serverless 1 Eventing Apiserver Receive Adapter"

ENTRYPOINT ["/usr/bin/main"]

The CI config would be generated in this way:

base_images: ocp_ubi-minimal_8: name: ubi-minimal namespace: ocp tag: "8" openshift_release_rhel-8-release-golang-1.22-openshift-4.17: name: release namespace: openshift tag: rhel-8-release-golang-1.22-openshift-4.17 images:

Next steps after merging this PR would be:

mgencur commented 2 months ago

/hold

mgencur commented 2 months ago

/unhold

mgencur commented 2 months ago

Rebased. Ready for review.

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mgencur, pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/openshift-knative/hack/blob/main/OWNERS)~~ [mgencur,pierDipi] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment