Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,21 @@ RUN apk add --no-cache bash openssl tzdata nodejs npm python3 libsndfile supervi
{ apk del --no-cache npm 2>/dev/null || true; }

WORKDIR /app
ENV PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \
XDG_CACHE_HOME=/app/.cache \
PATH="/app/.venv/bin:${PATH}"
ENV PATH="/app/.venv/bin:${PATH}"

COPY --from=builder /app /app

RUN find /app/.venv -type f -path "*/tornado/test/*" -delete && \
find /app/.venv -type d -path "*/tornado/test" -delete

# Regenerate the Prisma client in the runtime stage so the baked-in
# BINARY_PATHS resolve to a location outside /app. Users with volume mounts
# that shadow /app/.cache (e.g. readOnlyRootFilesystem + emptyDir) would
# otherwise lose access to the pre-downloaded query engine at runtime.
# Drop the builder's /app/.cache afterwards — it's stale and adds ~800 MB
# the runtime doesn't use.
RUN rm -rf /app/.cache && prisma generate --schema=./schema.prisma

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Binary re-download adds unnecessary network dependency

The rm -rf /app/.cache discards the query engine binary already downloaded by the builder, and prisma generate then fetches it again from the internet into /root/.cache. This doubles the download time and requires outbound internet access from the runtime layer — which may fail in air-gapped or --network=none build environments.

Consider copying the binary from the builder's /app/.cache into /root/.cache before running prisma generate, so the download only happens once.


EXPOSE 4000/tcp

COPY docker/supervisord.conf /etc/supervisord.conf
Expand Down
12 changes: 9 additions & 3 deletions docker/Dockerfile.database
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,21 @@ RUN apk add --no-cache bash openssl tzdata nodejs npm python3 libsndfile supervi
{ apk del --no-cache npm 2>/dev/null || true; }

WORKDIR /app
ENV PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \
XDG_CACHE_HOME=/app/.cache \
PATH="/app/.venv/bin:${PATH}"
ENV PATH="/app/.venv/bin:${PATH}"

COPY --from=builder /app /app

RUN find /app/.venv -type f -path "*/tornado/test/*" -delete && \
find /app/.venv -type d -path "*/tornado/test" -delete

# Regenerate the Prisma client in the runtime stage so the baked-in
# BINARY_PATHS resolve to a location outside /app. Users with volume mounts
# that shadow /app/.cache (e.g. readOnlyRootFilesystem + emptyDir) would
# otherwise lose access to the pre-downloaded query engine at runtime.
# Drop the builder's /app/.cache afterwards — it's stale and adds ~800 MB
# the runtime doesn't use.
RUN rm -rf /app/.cache && prisma generate --schema=./schema.prisma

EXPOSE 4000/tcp

COPY docker/supervisord.conf /etc/supervisord.conf
Expand Down
Loading