All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 53s
Traefik filters containers that are 'unhealthy' or still 'starting' (no health result yet). The old 30s interval meant kochwas stayed in 'starting' for 30+ seconds after boot, blocking Traefik from routing to it. New timing: --start-period=20s grace window — failures don't mark unhealthy yet --start-interval=2s fast probes during start-period --interval=15s steady-state cadence after first success --timeout=5s, retries=3 unchanged Container becomes 'healthy' within ~2-5s of the app coming up, so Traefik picks it up almost immediately after 'docker compose up'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
898 B
Docker
40 lines
898 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM node:22-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# Alpine needs build tools for better-sqlite3 native module
|
|
RUN apk add --no-cache python3 make g++ libc6-compat
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Remove dev dependencies for the runtime image
|
|
RUN npm prune --omit=dev
|
|
|
|
FROM node:22-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
COPY --from=builder /app/build ./build
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/package.json ./package.json
|
|
|
|
ENV NODE_ENV=production
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=3000
|
|
ENV DATABASE_PATH=/data/kochwas.db
|
|
ENV IMAGE_DIR=/data/images
|
|
|
|
VOLUME ["/data"]
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=15s --timeout=5s --retries=3 --start-period=20s --start-interval=2s \
|
|
CMD wget -qO- http://localhost:3000/api/health > /dev/null || exit 1
|
|
|
|
CMD ["node", "build/index.js"]
|