ARG-Variablen durch feste Werte in FROM ersetzt — nicht per .env ueberschreibbar. PYTHON_VERSION, NODE_VERSION, NPM_VERSION, NGINX_VERSION aus .env, env-sample und Compose-Dateien entfernt. Deployment-Anleitung erstellt und entsprechend angepasst. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
28 lines
1.7 KiB
Docker
28 lines
1.7 KiB
Docker
# ── Stage: frontend — baut das TypeScript-JS-Bundle ──────────────
|
|
# Node.js, npm und node_modules landen NICHT im Prod-Image.
|
|
FROM node:lts-bookworm-slim AS frontend
|
|
# Zielverzeichnis fuer rollup-Output erstellen (absoluter Pfad wie in rollup.config.mjs)
|
|
RUN mkdir -p /usr/opt/pythonapp/NGINX_Server/html/static
|
|
WORKDIR /usr/opt/pythonapp/Client
|
|
# Erst package.json + lockfile kopieren (besseres Layer-Caching)
|
|
COPY Client/package.json Client/package-lock.json* ./
|
|
RUN npm ci || npm install
|
|
# Rest des Client-Quellcodes kopieren
|
|
COPY Client/ ./
|
|
# config.ini wird fuer rollup benoetigt (inireader.mjs liest Version/Name)
|
|
COPY App_Server/root/config.ini /usr/opt/pythonapp/App_Server/root/config.ini
|
|
# tsc + rollup ausfuehren — Output geht nach /usr/opt/pythonapp/NGINX_Server/html/static/
|
|
RUN npm run build
|
|
|
|
# ── Stage: nginx ────────────────────────────────────────────────
|
|
FROM nginx:mainline-alpine
|
|
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
|
RUN mkdir -p /etc/certs /etc/nginx/templates
|
|
COPY NGINX_Server/10-select-ssl.sh /docker-entrypoint.d/10-select-ssl.sh
|
|
RUN chmod +x /docker-entrypoint.d/10-select-ssl.sh
|
|
# NGINX Config-Templates ins Image kopieren (in Prod; Dev ueberschreibt per bind-mount)
|
|
COPY NGINX_Server/configtemplates/ /etc/nginx/configtemplates/
|
|
# Alle statischen Dateien aus dem Repo kopieren (CSS, favicon, fonts, logo)
|
|
COPY NGINX_Server/html/static/ /usr/share/nginx/html/static/
|
|
# JS-Bundle aus der frontend-Stage ueberschreibt ggf. vorhandene alte JS-Dateien
|
|
COPY --from=frontend /usr/opt/pythonapp/NGINX_Server/html/static/ /usr/share/nginx/html/static/ |