From af6c58d322b14858720639653e24df2f93f3ef92 Mon Sep 17 00:00:00 2001 From: Guiorgy Date: Wed, 31 Dec 2025 01:50:53 +0400 Subject: [PATCH 1/3] mount .git from host instead of copying & removing --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3410adc94ad..4baa62f582b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,6 @@ RUN apk add --no-cache \ yarn \ zlib-dev -COPY .git /pgadmin4/.git # Create the /pgadmin4 directory and copy the source into it. Explicitly # remove the node_modules directory as we'll recreate a clean version, as well # as various other files we don't want @@ -40,7 +39,8 @@ COPY web /pgadmin4/web WORKDIR /pgadmin4/web # Build the JS vendor code in the app-builder, and then remove the vendor source. -RUN export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" && \ +RUN --mount=type=bind,source=.git,target=/pgadmin4/.git \ + export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" && \ npm install -g corepack && \ corepack enable && \ yarn set version berry && \ @@ -55,8 +55,7 @@ RUN export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" && \ webpack.* \ jest.config.js \ babel.* \ - ./pgadmin/static/js/generated/.cache \ - /pgadmin4/.git + ./pgadmin/static/js/generated/.cache ######################################################################### # Next, create the base environment for Python From 28ddf8db13a6419831cb9e07e2c20c270d101341 Mon Sep 17 00:00:00 2001 From: Guiorgy Date: Wed, 31 Dec 2025 02:41:21 +0400 Subject: [PATCH 2/3] use tmpfs for build cache in Dockerfile --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4baa62f582b..d6822e5bdd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,8 @@ WORKDIR /pgadmin4/web # Build the JS vendor code in the app-builder, and then remove the vendor source. RUN --mount=type=bind,source=.git,target=/pgadmin4/.git \ + --mount=type=tmpfs,target=node_modules \ + --mount=type=tmpfs,target=pgadmin/static/js/generated/.cache \ export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" && \ npm install -g corepack && \ corepack enable && \ @@ -47,15 +49,13 @@ RUN --mount=type=bind,source=.git,target=/pgadmin4/.git \ yarn set version 4 && \ yarn install && \ yarn run bundle && \ - rm -rf node_modules \ - yarn.lock \ + rm -rf yarn.lock \ package.json \ .[^.]* \ babel.cfg \ webpack.* \ jest.config.js \ - babel.* \ - ./pgadmin/static/js/generated/.cache + babel.* ######################################################################### # Next, create the base environment for Python From 84372601e04228e0db88a9c8c828600fa0122587 Mon Sep 17 00:00:00 2001 From: Guiorgy Date: Wed, 31 Dec 2025 03:16:02 +0400 Subject: [PATCH 3/3] avoid rerunning apk when requirements.txt changes --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6822e5bdd4..9835060290a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,7 +64,6 @@ RUN --mount=type=bind,source=.git,target=/pgadmin4/.git \ FROM python:3-alpine AS env-builder # Install dependencies -COPY requirements.txt / RUN apk add --no-cache \ make && \ apk add --no-cache --virtual build-deps \ @@ -77,8 +76,9 @@ RUN apk add --no-cache \ cargo \ zlib-dev \ libjpeg-turbo-dev \ - libpng-dev && \ - python3 -m venv --system-site-packages --without-pip /venv && \ + libpng-dev +COPY requirements.txt / +RUN python3 -m venv --system-site-packages --without-pip /venv && \ /venv/bin/python3 -m pip install --no-cache-dir -r requirements.txt && \ apk del --no-cache build-deps