From 55b8d0e1e90a268ffb159071b3bad9c089b95e86 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Fri, 24 Jan 2025 11:47:53 +0100
Subject: [PATCH] feat(docker): forward to default entrypoint (#33819)

---
 .github/workflows/build.yml             |  5 ++++-
 tools/docker.ts                         |  1 +
 tools/docker/Dockerfile                 |  5 +++--
 tools/docker/bin/renovate-entrypoint.sh | 13 ++-----------
 4 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 22d2f0031d..ff0cc768f7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -562,10 +562,13 @@ jobs:
         run: pnpm build
 
       - name: Build docker
-        run: pnpm build:docker build --tries=3
+        run: pnpm build:docker build --tries=3 --args '--load'
         env:
           LOG_LEVEL: debug
 
+      - name: Test docker
+        run: docker run -e LOG_LEVEL=debug --rm renovate/renovate --version
+
       - name: Pack
         run: pnpm test-e2e:pack
 
diff --git a/tools/docker.ts b/tools/docker.ts
index 42cd36647d..734b473ba3 100644
--- a/tools/docker.ts
+++ b/tools/docker.ts
@@ -16,6 +16,7 @@ program
     'delay between tries for docker build (eg. 5s, 10m, 1h)',
     '30s',
   )
+  .option('--args <args...>', 'additional arguments to pass to docker build')
   .action(async (opts) => {
     logger.info('Building docker images ...');
     await bake('build', opts);
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index a079431cba..27976361e5 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -59,9 +59,10 @@ COPY --link pnpm-lock.yaml ./
 
 # set `npm_config_arch` for `prebuild-install`
 # set `npm_config_platform_arch` for `install-artifact-from-github`
+ENV npm_config_arch=${ARCH} npm_config_platform_arch=${ARCH}
+
 # only fetch deps from lockfile https://pnpm.io/cli/fetch
 RUN set -ex; \
-  export npm_config_arch=${ARCH} npm_config_platform_arch=${ARCH}; \
   corepack pnpm fetch --prod; \
   true
 
@@ -97,7 +98,7 @@ RUN ln -sf /usr/local/renovate/node /bin/node
 
 # ensure default base and cache directories exist.
 RUN mkdir -p /tmp/renovate/cache && \
-    chmod -R 777 /tmp/renovate
+  chmod -R 777 /tmp/renovate
 
 # test
 RUN set -ex; \
diff --git a/tools/docker/bin/renovate-entrypoint.sh b/tools/docker/bin/renovate-entrypoint.sh
index 7e0d39a177..6962881d0d 100755
--- a/tools/docker/bin/renovate-entrypoint.sh
+++ b/tools/docker/bin/renovate-entrypoint.sh
@@ -1,15 +1,5 @@
 #!/bin/bash
 
-if [[ -f "/usr/local/etc/env" && -z "${CONTAINERBASE_ENV+x}" ]]; then
-    # shellcheck source=/dev/null
-  . /usr/local/etc/env
-fi
-
-if [[ ! -d "/tmp/containerbase" ]]; then
-  # initialize all prepared tools
-  containerbase-cli init tool all
-fi
-
 if [[ "${1:0:1}" = '-' ]]; then
   # assume $1 is renovate flag
   set -- renovate "$@"
@@ -20,4 +10,5 @@ if [[ ! -x "$(command -v "${1}")" ]]; then
   set -- renovate "$@"
 fi
 
-exec dumb-init -- "$@"
+# call the original entrypoint
+exec docker-entrypoint.sh "$@"
-- 
GitLab