Files
windwiderstand/Dockerfile
T
Peter Meier 91e66d8d4f
Deploy / verify (push) Successful in 1m10s
Deploy / deploy (push) Successful in 1m27s
fix(docker): healthcheck 127.0.0.1 statt localhost (IPv6 ::1 refused)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:25:36 +02:00

42 lines
1.4 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ─────────────────────────────────────────────
# Stage 1: Build
# ─────────────────────────────────────────────
FROM node:22-alpine AS builder
WORKDIR /app
# Erst nur package*.json besseres Layer-Caching
COPY package*.json ./
# prepare läuft svelte-kit sync (|| true → unkritisch wenn Config fehlt)
RUN npm ci
COPY . .
RUN npm run build
# ─────────────────────────────────────────────
# Stage 2: Schlankes Production-Image
# ─────────────────────────────────────────────
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Nur Production-Deps, kein postinstall nötig
COPY package*.json ./
RUN npm ci --omit=dev --ignore-scripts
# Build-Artefakt aus Stage 1
COPY --from=builder /app/build ./build
# Non-root user
RUN addgroup -g 1001 -S nodejs \
&& adduser -S svelte -u 1001 -G nodejs \
&& chown -R svelte:nodejs /app
USER svelte
EXPOSE 3001
ENV PORT=3001
HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=3 \
CMD wget -qO- http://127.0.0.1:3001/ > /dev/null || exit 1
CMD ["node", "build"]