Dockerfile ready

This commit is contained in:
Luke Vella 2025-04-27 14:10:02 +01:00
parent 0f30208427
commit d2cea415f7
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C
2 changed files with 12 additions and 3 deletions

View file

@ -57,15 +57,24 @@ RUN apt-get update \
WORKDIR /app
# Install prisma globally needed for runtime operations like migrations
RUN pnpm add -g prisma
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Set HOME env for non-root user
ENV HOME=/app
# Ensure /app is writable by nextjs user
RUN chown -R nextjs:nodejs /app
# Ensure /app is writable by nextjs user AND fix perms for global pnpm dir
RUN chown -R nextjs:nodejs /app /pnpm
USER nextjs
# Copy Corepack cache from installer stage to avoid runtime download
COPY --from=installer /root/.cache/node/corepack/ /app/.cache/node/corepack/
# Copy app files
COPY --from=builder /app/scripts/docker-start.sh ./
COPY --from=builder /app/packages/database/prisma ./prisma
COPY --from=installer /app/apps/web/next.config.js .

View file

@ -4,5 +4,5 @@ set -e
export DIRECT_DATABASE_URL=$DATABASE_URL
export AUTH_URL=$NEXT_PUBLIC_BASE_URL
pnpm dlx prisma migrate deploy --schema=./prisma/schema.prisma
pnpm prisma migrate deploy --schema=./prisma/schema.prisma
node apps/web/server.js