Skip to content

Commit b7db96f

Browse files
committed
apply new dockerfile prisma solution to offline binaries download
1 parent 400d9a0 commit b7db96f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docker/Dockerfile.non_root

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,18 @@ RUN pip uninstall jwt -y && \
5555
pip install PyJWT==2.9.0 --no-cache-dir
5656

5757
# --- Prisma Handling for Non-Root User ---
58-
# Set Prisma cache directories
58+
# Set Prisma cache directory (npm cache no longer needed with binary pre-caching)
5959
ENV PRISMA_BINARY_CACHE_DIR=/nonexistent
60-
ENV NPM_CONFIG_CACHE=/.npm
6160

6261
# Install prisma and make entrypoints executable
6362
RUN pip install --no-cache-dir prisma && \
6463
chmod +x docker/entrypoint.sh && \
6564
chmod +x docker/prod_entrypoint.sh
6665

6766
# Create directories and set permissions for non-root user
68-
RUN mkdir -p /nonexistent /.npm && \
67+
RUN mkdir -p /nonexistent && \
6968
chown -R nobody:nogroup /app && \
70-
chown -R nobody:nogroup /nonexistent /.npm && \
69+
chown -R nobody:nogroup /nonexistent && \
7170
PRISMA_PATH=$(python -c "import os, prisma; print(os.path.dirname(prisma.__file__))") && \
7271
chown -R nobody:nogroup $PRISMA_PATH
7372

@@ -91,18 +90,18 @@ USER nobody
9190
# Set HOME for prisma generate to have a writable directory
9291
ENV HOME=/app
9392

94-
# Elegant solution: Force Prisma to download and cache all binaries at build time
93+
# Force Prisma to download and cache all binaries at build time -> for offline deployment
9594
# This uses official Prisma environment variables for offline deployment
9695
ENV PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1
9796
ENV PRISMA_CLI_BINARY_TARGETS=linux-musl-openssl-3.0.x,linux-musl-arm64-openssl-3.0.x
9897

99-
# Generate Prisma client and cache all engine binaries
98+
# this will generate the Prisma client and cache all engine binaries
10099
RUN prisma generate
101100

102-
# Verify all engines are properly cached by running essential commands
103101
# These commands force download of all CLI binaries without dummy database URLs
104102
RUN prisma version
105103
RUN prisma format --schema=/dev/null || echo "Schema format test completed"
104+
106105
# --- End of Prisma Handling ---
107106

108107
EXPOSE 4000/tcp

0 commit comments

Comments
 (0)