Update Docker configuration for production

This commit is contained in:
michi 2025-08-20 18:51:42 +02:00
parent 7892a7ab67
commit c0a184829c
2 changed files with 27 additions and 3 deletions

View File

@ -1,10 +1,33 @@
FROM node:18-alpine
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
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
USER nextjs
EXPOSE 3000
CMD ["npm", "run", "dev"]
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.

View File

@ -1,5 +1,6 @@
module.exports = {
reactStrictMode: true,
output: 'standalone',
images: {
domains: ['images.unsplash.com', 'localhost'],
},