|
1 | | -# This is not generated Dockerfile, yet! |
| 1 | +# Not generated yet! |
| 2 | +ARG GO_BUILDER=registry.ci.openshift.org/openshift/release:rhel-9-release-golang-1.23-openshift-4.19 |
2 | 3 | ARG GO_RUNTIME=registry.access.redhat.com/ubi9/ubi-minimal |
3 | | -ARG CLI_ARTIFACTS=registry.redhat.io/openshift-serverless-1/kn-client-cli-artifacts-rhel8:1.36.0 |
4 | 4 |
|
5 | | -FROM $CLI_ARTIFACTS as builder |
| 5 | +# ---------- BUILD STAGE ---------- |
| 6 | +FROM $GO_BUILDER AS builder |
| 7 | +WORKDIR /workspace |
| 8 | +# Allow copying from higher directory when context is limited |
| 9 | +COPY . . |
| 10 | +ENV GO_COMPLIANCE_DEBUG=1 |
| 11 | +ENV KN_PLUGIN_FUNC_UTIL_IMAGE=registry.redhat.io/openshift-serverless-1/kn-plugin-func-func-util-rhel9@sha256:a181b639a19b3c36367eec41e5ac0e030bcfcb247b96e6843ff60a9561ead85dn |
| 12 | +ENV KN_PLUGIN_EVENT_SENDER_IMAGE=registry.redhat.io/openshift-serverless-1/kn-plugin-event-sender-rhel9@sha256:d28cd64bfc1d0978d6f95e8b70d5bf7c36d6b92c0d60460f7ac6fa2b2ba0a15b |
| 13 | +# Build binaries |
| 14 | +# RUN make build-cross-package |
| 15 | +RUN ./hack/build.sh -p linux amd64 |
| 16 | +RUN ./hack/build.sh -p linux ppc64le |
| 17 | +RUN ./hack/build.sh -p linux s390x |
| 18 | +RUN ./hack/build.sh -p linux arm64 |
| 19 | +RUN ./hack/build.sh -p darwin amd64 |
| 20 | +RUN ./hack/build.sh -p darwin arm64 |
| 21 | +RUN ./hack/build.sh -p windows amd64 |
6 | 22 |
|
7 | | -FROM $GO_RUNTIME |
| 23 | +RUN chmod +x kn-linux-amd64 kn-linux-ppc64le kn-linux-s390x kn-windows-amd64.exe kn-darwin-amd64 kn-linux-arm64 kn-darwin-arm64 |
| 24 | + |
| 25 | +## ---------- PACKAGING STAGE ---------- |
| 26 | +RUN dnf install -y tar zip |
8 | 27 |
|
9 | | -ARG VERSION=knative-v1.17 |
| 28 | +RUN tar --transform='flags=r;s|kn-linux-amd64|kn|' -zcf kn-linux-amd64.tar.gz kn-linux-amd64 LICENSE \ |
| 29 | + && tar --transform='flags=r;s|kn-linux-ppc64le|kn|' -zcf kn-linux-ppc64le.tar.gz kn-linux-ppc64le LICENSE \ |
| 30 | + && tar --transform='flags=r;s|kn-linux-s390x|kn|' -zcf kn-linux-s390x.tar.gz kn-linux-s390x LICENSE \ |
| 31 | + && tar --transform='flags=r;s|kn-darwin-amd64|kn|' -zcf kn-macos-amd64.tar.gz kn-darwin-amd64 LICENSE \ |
| 32 | + && tar --transform='flags=r;s|kn-linux-arm64|kn|' -zcf kn-linux-arm64.tar.gz kn-linux-arm64 LICENSE \ |
| 33 | + && tar --transform='flags=r;s|kn-darwin-arm64|kn|' -zcf kn-macos-arm64.tar.gz kn-darwin-arm64 LICENSE |
10 | 34 |
|
11 | | -RUN mkdir -p /usr/share/kn |
| 35 | +RUN mkdir "windows" && mv kn-windows-amd64.exe ./windows/kn.exe && cp LICENSE ./windows/ && zip --quiet --junk-path - windows/* > kn-windows-amd64.zip |
| 36 | + |
| 37 | +# ---------- FINAL RUNTIME IMAGE ---------- |
| 38 | +FROM $GO_RUNTIME |
| 39 | +RUN mkdir -p /usr/share/kn/{linux_amd64,linux_arm64,linux_ppc64le,linux_s390x,macos_amd64,macos_arm64,windows} |
12 | 40 |
|
13 | | -COPY --from=builder /usr/share/kn /usr/share/kn |
14 | | -COPY LICENSE /licenses/ |
| 41 | +COPY --from=builder /workspace/kn-linux-amd64.tar.gz /usr/share/kn/linux_amd64/ |
| 42 | +COPY --from=builder /workspace/kn-linux-ppc64le.tar.gz /usr/share/kn/linux_ppc64le/ |
| 43 | +COPY --from=builder /workspace/kn-linux-s390x.tar.gz /usr/share/kn/linux_s390x/ |
| 44 | +COPY --from=builder /workspace/kn-macos-amd64.tar.gz /usr/share/kn/macos_amd64/ |
| 45 | +COPY --from=builder /workspace/kn-windows-amd64.zip /usr/share/kn/windows/ |
| 46 | +COPY --from=builder /workspace/kn-linux-arm64.tar.gz /usr/share/kn/linux_arm64/ |
| 47 | +COPY --from=builder /workspace/kn-linux-arm64.tar.gz /usr/share/kn/macos_arm64/ |
| 48 | +COPY --from=builder /workspace/LICENSE /licenses/ |
15 | 49 |
|
16 | 50 | USER 65532 |
17 | 51 |
|
|
0 commit comments