fix(docker): fix EACCES on .next/cache/images — chown for nextjs user
This commit is contained in:
@@ -5,7 +5,7 @@ WORKDIR /app
|
||||
# --- Install + Build in one stage ---
|
||||
FROM base AS builder
|
||||
# CACHE_BUST: change this value to force a full rebuild (busts Docker layer cache)
|
||||
ARG CACHE_BUST=8
|
||||
ARG CACHE_BUST=9
|
||||
RUN echo "Cache bust: ${CACHE_BUST}"
|
||||
COPY . .
|
||||
RUN pnpm install --no-frozen-lockfile
|
||||
@@ -32,6 +32,10 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=builder /app/ ./
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
|
||||
|
||||
# Ensure Next.js cache directories are writable by the nextjs user
|
||||
RUN mkdir -p /app/apps/web/.next/cache && chown -R nextjs:nodejs /app/apps/web/.next/cache
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
Reference in New Issue
Block a user