Skip to content

Commit 0bd6dde

Browse files
committed
fix(docker): keep ISR and suffix-list caches writable on a read-only root
1 parent de6e53c commit 0bd6dde

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎docker/app.Dockerfile‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,14 @@ COPY --from=builder --chown=nextjs:nodejs /app/apps/sim/lib/execution/sandbox/bu
252252
# - apps/sim/.next/cache: the Next image optimizer's disk cache
253253
# (.next/cache/images) and the data cache for `fetch` calls with
254254
# `next.revalidate`.
255+
# - apps/sim/.next/server/route-cache: where Next writes every revalidated
256+
# (ISR) page and route handler response.
255257
# Keep the VOLUME line after every step that writes to these paths: the
256258
# classic builder discards later build-time changes to a declared volume.
257-
RUN mkdir -p apps/sim/.next/cache && \
258-
chown -R nextjs:nodejs apps/sim/.next/cache && \
259+
RUN mkdir -p apps/sim/.next/cache apps/sim/.next/server/route-cache && \
260+
chown -R nextjs:nodejs apps/sim/.next/cache apps/sim/.next/server/route-cache && \
259261
chmod 1777 /tmp
260-
VOLUME ["/tmp", "/app/apps/sim/.next/cache"]
262+
VOLUME ["/tmp", "/app/apps/sim/.next/cache", "/app/apps/sim/.next/server/route-cache"]
261263

262264
# Switch to non-root user
263265
USER nextjs

‎docker/pii.Dockerfile‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ COPY --chown=pii:pii --chmod=755 docker/pii-entrypoint.sh ./
4646
# and /tmp (mode 1777), Python's tempfile scratch, stays writable because ECS
4747
# copies the image's /tmp into a bind volume mounted at a VOLUME path. The
4848
# VOLUME line stays below the model download, which stages wheels in /tmp.
49-
ENV PYTHONDONTWRITEBYTECODE=1
49+
# tldextract (pulled in by Presidio) caches the Public Suffix List under
50+
# $HOME/.cache by default; point it at /tmp so it caches instead of
51+
# refetching the list on every start.
52+
ENV PYTHONDONTWRITEBYTECODE=1 \
53+
TLDEXTRACT_CACHE=/tmp/tldextract
5054
RUN chmod 1777 /tmp
5155
VOLUME ["/tmp"]
5256

0 commit comments

Comments
 (0)