From 58289968d6f7b15e30853f8aa10d93518991ee3a Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Wed, 18 Sep 2024 11:45:55 +0200 Subject: [PATCH 1/2] Fix broken Dockerfile and minor improvements This fixes an issue introduced by a past PR (https://github.com/stackabletech/operator-templating/pull/432). It uses an argument that doesn't exist ("STACKABLE_USER_NAME"). In the course of diagnosing that I stumbled across a few inconsistencies with our "docker-images" Dockerfiles which I am addressing here as well. - Updates the Helm version used (not caught by Renovate yet) - Sets a build timeout for the build & package phase to two hours (down from the default of 6) - Adds the dnf.conf file - Adds convenience utilities - Adds a few common aliases and a better prompt --- template/.github/workflows/build.yml.j2 | 3 +- template/docker/Dockerfile.j2 | 61 ++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/template/.github/workflows/build.yml.j2 b/template/.github/workflows/build.yml.j2 index 9d35d84c..cbda8cb5 100644 --- a/template/.github/workflows/build.yml.j2 +++ b/template/.github/workflows/build.yml.j2 @@ -265,7 +265,7 @@ jobs: - name: Set up Helm uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 with: - version: v3.13.3 + version: v3.16.1 - name: Set up cargo uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a with: @@ -310,6 +310,7 @@ jobs: matrix: runner: ["ubuntu-latest", "ubicloud-standard-8-arm"] runs-on: ${{ matrix.runner }} + timeout-minutes: 120 permissions: id-token: write env: diff --git a/template/docker/Dockerfile.j2 b/template/docker/Dockerfile.j2 index 58e44677..27a0379e 100644 --- a/template/docker/Dockerfile.j2 +++ b/template/docker/Dockerfile.j2 @@ -66,23 +66,55 @@ LABEL io.openshift.tags="ubi9,stackable,sdp,{[ operator.product_string }]" LABEL io.k8s.description="Deploy and manage {[ operator.pretty_string }] clusters." LABEL io.k8s.display-name="Stackable Operator for {[ operator.pretty_string }]" +COPY <> /stackable/.bashrc + +echo -e "if [ -f ~/.bashrc ]; then\n\tsource ~/.bashrc\nfi" >> /stackable/.profile + +chown ${STACKABLE_USER_UID}:0 /stackable/.bashrc +chown ${STACKABLE_USER_UID}:0 /stackable/.profile EOF COPY LICENSE /licenses/LICENSE From d91448931bc2f67a74d891a3608f232b0b2fc9e3 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Wed, 18 Sep 2024 12:42:50 +0200 Subject: [PATCH 2/2] Add a small README --- template/docker/Dockerfile.j2 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/template/docker/Dockerfile.j2 b/template/docker/Dockerfile.j2 index 27a0379e..cc56bd07 100644 --- a/template/docker/Dockerfile.j2 +++ b/template/docker/Dockerfile.j2 @@ -143,11 +143,25 @@ echo -e "if [ -f ~/.bashrc ]; then\n\tsource ~/.bashrc\nfi" >> /stackable/.profi chown ${STACKABLE_USER_UID}:0 /stackable/.bashrc chown ${STACKABLE_USER_UID}:0 /stackable/.profile + +# All files and folders owned by root to support running as arbitrary users +# This is best practice as all container users will belong to the root group (0) +# This is not very relevant for the operator images but this makes it consistent with `docker-images` +chown -R ${STACKABLE_USER_UID}:0 /stackable +chmod -R g=u /stackable +EOF + +COPY <