diff --git a/Dockerfile b/Dockerfile index b2aeedc..6d436eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,24 +56,22 @@ WORKDIR /app ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 -# Create non-root user RUN addgroup --system --gid 1001 nodejs \ && adduser --system --uid 1001 nextjs -# Copy built output +# Copy standalone build and static files COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -# ✅ FIX: ensure Next.js cache directory exists and is writable -RUN mkdir -p /app/.next/cache \ - && chown -R nextjs:nodejs /app/.next +# 1. Create the specific cache directory Next.js is looking for +# 2. Give ownership to the 'nextjs' user +RUN mkdir -p /app/.next/cache/images && chown -R nextjs:nodejs /app/.next USER nextjs +EXPOSE 3000 ENV PORT=3000 ENV HOSTNAME=0.0.0.0 -EXPOSE 3000 - CMD ["node", "server.js"] \ No newline at end of file