Files
ndsolutionswebsite/Dockerfile
Daniel S 64c257f050
Some checks failed
Production Build & Deploy / build-and-deploy (push) Failing after 9s
feat(docker): add automatic container entrypoint seeding script
2026-08-09 22:05:48 +02:00

42 lines
955 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 --only=production
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"]