diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ae248c9..71644a0b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ All notable changes to this project will be documented in this file. - spark-connect-client: A new image for Spark connect tests and demos ([#1034]) - nifi: check for correct permissions and ownerships in /stackable folder via `check-permissions-ownership.sh` provided in stackable-base image ([#1027]). +- opa: check for correct permissions and ownerships in /stackable folder via + `check-permissions-ownership.sh` provided in stackable-base image ([#1038]). ### Changed @@ -21,12 +23,14 @@ All notable changes to this project will be documented in this file. - hadoop: reduce docker image size by removing the recursive chown/chmods in the final image ([#1029]). - nifi: reduce docker image size by removing the recursive chown/chmods in the final image ([#1027]). +- opa: reduce docker image size by removing the recursive chown/chmods in the final image ([#1038]). - spark-k8s: reduce docker image size by removing the recursive chown/chmods in the final image ([#1042]). - Add `--locked` flag to `cargo install` commands for reproducible builds ([#1044]). [#1027]: https://github.com/stackabletech/docker-images/pull/1027 [#1029]: https://github.com/stackabletech/docker-images/pull/1029 [#1034]: https://github.com/stackabletech/docker-images/pull/1034 +[#1038]: https://github.com/stackabletech/docker-images/pull/1038 [#1042]: https://github.com/stackabletech/docker-images/pull/1042 [#1044]: https://github.com/stackabletech/docker-images/pull/1044 [#1050]: https://github.com/stackabletech/docker-images/pull/1050 diff --git a/opa/Dockerfile b/opa/Dockerfile index 1b97bd55d..0437fb466 100644 --- a/opa/Dockerfile +++ b/opa/Dockerfile @@ -6,18 +6,20 @@ FROM stackable/image/stackable-base AS opa-bundle-builder ARG BUNDLE_BUILDER_VERSION # Update image and install everything needed for Rustup & Rust -RUN microdnf update \ - && microdnf install \ - cmake \ - gcc \ - gcc-c++ \ - git \ - make \ - openssl-devel \ - pkg-config \ - systemd-devel \ - unzip \ - && rm -rf /var/cache/yum +RUN <= 1.23.1) -RUN go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.7.0 -RUN curl "https://repo.stackable.tech/repository/packages/opa/opa_${PRODUCT}.tar.gz" -o opa.tar.gz && \ - tar -zxvf opa.tar.gz && \ - mv "opa-${PRODUCT}" opa +go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.7.0 +curl "https://repo.stackable.tech/repository/packages/opa/opa_${PRODUCT}.tar.gz" -o opa.tar.gz +tar -zxvf opa.tar.gz +mv "opa-${PRODUCT}" opa +EOF WORKDIR /opa @@ -97,7 +112,12 @@ git config user.name "Fake commiter" git commit --allow-empty --message "Fake commit, so that we can create a tag" git tag "v${PRODUCT}" go build -o opa -buildmode=exe -~/go/bin/cyclonedx-gomod app -json -output-version 1.5 -output "opa_${PRODUCT}.cdx.json" -packages -files +# move artifact to /stackable/*/ to copy in final image +~/go/bin/cyclonedx-gomod app -json -output-version 1.5 -output /stackable/opa/"opa_${PRODUCT}.cdx.json" -packages -files +# move artifact to /stackable/* to copy in final image +mv /opa/opa /stackable/opa/ +# set correct groups +chmod -R g=u /stackable/opa EOF FROM stackable/image/vector @@ -107,43 +127,46 @@ ARG RELEASE ARG STACKABLE_USER_UID LABEL name="Open Policy Agent" \ - maintainer="info@stackable.tech" \ - vendor="Stackable GmbH" \ - version="${PRODUCT}" \ - release="${RELEASE}" \ - summary="The Stackable image for Open Policy Agent (OPA)." \ - description="This image is deployed by the Stackable Operator for OPA." + maintainer="info@stackable.tech" \ + vendor="Stackable GmbH" \ + version="${PRODUCT}" \ + release="${RELEASE}" \ + summary="The Stackable image for Open Policy Agent (OPA)." \ + description="This image is deployed by the Stackable Operator for OPA." -COPY opa/licenses /licenses +COPY --chown=${STACKABLE_USER_UID}:0 opa/licenses /licenses -COPY --from=opa-builder --chown=${STACKABLE_USER_UID}:0 /opa/opa /stackable/opa/opa -COPY --from=opa-builder --chown=${STACKABLE_USER_UID}:0 /opa/opa_${PRODUCT}.cdx.json /stackable/opa/ +COPY --from=opa-builder --chown=${STACKABLE_USER_UID}:0 /stackable/opa /stackable/opa COPY --from=opa-bundle-builder --chown=${STACKABLE_USER_UID}:0 /opa-bundle-builder/target/release/stackable-opa-bundle-builder /stackable/opa-bundle-builder COPY --from=multilog-builder --chown=${STACKABLE_USER_UID}:0 /daemontools/admin/daemontools/command/multilog /stackable/multilog -COPY --chown=${STACKABLE_USER_UID}:0 opa/stackable/bin /stackable/opa/bin - RUN <