homelab-dashboard/Dockerfile
Bilal Teke c7fd939f41 v4.1
2026-04-20 20:35:43 +02:00

49 lines
No EOL
1.1 KiB
Docker

# Multi-stage build for Next.js standalone output
# Verwende ein robustes Debian-basiertes Node-Image für native Module
FROM node:20-slim AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
# Build source code
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
# Kopiere gebaute App und node_modules
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/src ./src
COPY --from=builder /app/data ./data
# Erstelle Datenverzeichnis für SQLite, falls nicht vorhanden
RUN mkdir -p /app/data
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["npx", "next", "start"]