pixelbrew-webseite/Dockerfile
2025-08-26 15:09:27 +02:00

40 lines
963 B
Docker

# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy necessary files
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/data ./data
# Set correct permissions for data directory
RUN chown -R nextjs:nodejs ./data
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]
# Hinweis:
# Bei Next.js übernimmt Node.js den Webserver für die Auslieferung der Seiten.
# Du brauchst KEINEN zusätzlichen Webserver wie nginx oder apache im Container.
# Traefik leitet die Anfragen an den Node.js-Server im Container weiter (Port 3000).