Files
skrift-app/Dockerfile
Lucas Orth 32aa0a549f
All checks were successful
Build & Deploy / deploy (push) Successful in 26s
Import aus Monorepo (frischer Start)
2026-08-24 12:13:54 +02:00

31 lines
1.2 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.
# Mehrstufig: Node baut die App, nginx liefert nur noch statische Dateien aus.
# Im Endimage ist kein Node und kein node_modules mehr enthalten.
# ── Build ───────────────────────────────────────────────────
FROM node:20-alpine AS build
WORKDIR /app
# Die Directus-URL wird zur BUILD-Zeit ins Bundle geschrieben (Vite-Prinzip),
# nicht zur Laufzeit. Daher als Build-Argument.
ARG VITE_DIRECTUS_URL
ENV VITE_DIRECTUS_URL=$VITE_DIRECTUS_URL
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# ── Auslieferung ────────────────────────────────────────────
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
# BusyBox-wget (in nginx:alpine) kennt --spider/--tries nicht zuverlässig –
# stattdessen die Startseite nach /dev/null laden. Schlägt nur fehl, wenn
# nginx wirklich nicht antwortet.
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -q -O /dev/null http://127.0.0.1/ || exit 1