42 lines
948 B
Docker
42 lines
948 B
Docker
# STAGE 1: Dependencies & Build
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
ENV NODE_ENV=production
|
|
RUN npm run build
|
|
|
|
# STAGE 2: Production Runner
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=3000
|
|
ENV DATA_DIR=/app/data
|
|
|
|
# Ordner anlegen & Schreibrechte vorbereiten
|
|
RUN mkdir -p /app/data
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/public ./public
|
|
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
|
|
|
|
# Ausführungsrechte für das Entrypoint-Skript setzen
|
|
RUN chmod +x /app/docker-entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
|
|
# Healthcheck für Docker / Nginx Proxy
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
|
|
|
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
|
CMD ["node", "./dist/server/entry.mjs"]
|