|
| 1 | +# Detect the drift from the upstream Dockerfile |
| 2 | +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS drift |
| 3 | +WORKDIR /app |
| 4 | +COPY drift-cache/Dockerfile Dockerfile.cached |
| 5 | +COPY Dockerfile . |
| 6 | +# If the command below fails it means that the Dockerfile from this repository changed. |
| 7 | +# You have to update the Konflux Containerfile accordingly. |
| 8 | +# drift-cache/Dockerfile can be updated with the upstream contents once the Konflux version is aligned. |
| 9 | +RUN [ "$(sha1sum Dockerfile.cached | cut -d' ' -f1)" = "$(sha1sum Dockerfile | cut -d' ' -f1)" ] |
| 10 | + |
| 11 | + |
| 12 | +FROM registry.access.redhat.com/ubi9/go-toolset:1.22 as builder |
| 13 | +# dummy copy to trigger the drift detection |
| 14 | +COPY --from=drift /app/Dockerfile.cached . |
| 15 | +WORKDIR /workspace |
| 16 | +# Dummy RUN to create /workspace directory. |
| 17 | +# WORKDIR doesn't create the directory (at least for Podman). |
| 18 | +# Without this step, the following COPY may create /workspace |
| 19 | +# as root-owned (instead of go-toolset's default 1001) |
| 20 | +# leading to "Permission denied" errors during "make build-operator" |
| 21 | +# when trying to write output. |
| 22 | +RUN ls . |
| 23 | +COPY . /workspace |
| 24 | +RUN git config --global --add safe.directory /workspace |
| 25 | +# Build |
| 26 | +RUN make build-operator |
| 27 | + |
| 28 | +FROM registry.redhat.io/rhel9-4-els/rhel:9.4-943.1729773477 |
| 29 | +LABEL maintainer="Red Hat, Inc." |
| 30 | +LABEL com.redhat.component="external-dns-operator-container" |
| 31 | +LABEL name="external-dns-operator" |
| 32 | +LABEL version="1.3.0" |
| 33 | +WORKDIR / |
| 34 | +COPY --from=builder /workspace/bin/external-dns-operator / |
| 35 | +# Red Hat certified container images have licenses. |
| 36 | +COPY LICENSE /licenses/ |
| 37 | +USER 65532:65532 |
| 38 | +ENTRYPOINT ["/external-dns-operator"] |
0 commit comments