diff --git a/Dockerfile b/Dockerfile index 7e7d7fdc..6a05562d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,15 +56,16 @@ ENV UV_THREADPOOL_SIZE=3 RUN pnpm build # Stage 2: Runner -FROM node:20-alpine AS runner +FROM node:20-slim AS runner WORKDIR /app -# Install dependencies for sharp and health checks -RUN apk add --no-cache libc6-compat curl +# Install curl for health checks and procps +RUN apt-get update && apt-get install -y curl procps && rm -rf /var/lib/apt/lists/* # Create nextjs user and group -RUN addgroup --system --gid 1001 nodejs && \ - adduser --system --uid 1001 nextjs && \ +RUN groupadd --system --gid 1001 nodejs && \ + useradd --system --uid 1001 nextjs && \ + mkdir -p .next/cache/images && \ chown -R nextjs:nodejs /app USER nextjs @@ -72,11 +73,15 @@ USER nextjs ENV HOSTNAME="0.0.0.0" ENV PORT=3000 ENV NODE_ENV=production +ENV NEXT_SHARP_PATH=/app/node_modules/sharp # Copy standalone output COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -# Copy public and static files into the expected locations +# Copy public and static files - standalone expects them in specific locations COPY --from=builder --chown=nextjs:nodejs /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +# Ensure cache directory is writable for the nextjs user +# (Already handled by chown -R above, but explicit is better) + CMD ["node", "server.js"] diff --git a/package.json b/package.json index 545cd6b3..d0c364e0 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "prepare": "husky", "preinstall": "npx only-allow pnpm" }, - "version": "2.3.22-rc.15", + "version": "2.3.22-rc.16", "pnpm": { "onlyBuiltDependencies": [ "@parcel/watcher",