Files
website/Dockerfile
Matt 39bb603020
All checks were successful
build-website / build (push) Successful in 2m14s
fix: Docker container deployment issues
- Set proper environment variables (NODE_ENV, HOSTNAME, PORT)
- Use ENTRYPOINT and CMD for better container control
- Fix ownership issues with --chown on COPY commands
- Ensure public directory is copied correctly
- Combine user creation commands for efficiency

The container should now start properly with the Next.js standalone server.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 19:52:21 +02:00

40 lines
797 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy all files
COPY . .
# Build Next.js app
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV HOSTNAME="0.0.0.0"
ENV PORT=3000
# Create a non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
# Copy standalone build output with proper ownership
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
USER nextjs
EXPOSE 3000
# Use ENTRYPOINT and CMD for better container control
ENTRYPOINT ["node"]
CMD ["server.js"]