feat(deploy): Multi-Stage-Docker-Build fuer automatisches Deployment
- App_Server/Dockerfile: Build-Context auf Repo-Root, COPY-Pfade angepasst, ENTRYPOINT aktiviert, dev-Stage mit inittypescriptdev.sh - NGINX_Server/Dockerfile: Multi-Stage mit frontend-Stage (Node.js baut TypeScript), statische Dateien und Config-Templates ins Image kopiert - docker-compose.base.yaml: Context auf '.', python-venv Volume entfernt, NGINX_STATIC_DIR/CONFIG_TEMPLATE_DIR bind-mounts in Dev verschoben - docker-compose.dev.yaml: python-venv-dev Volume, APP_DEBUG=true, nginx-proxy mit bind-mounts fuer statische Dateien und Templates - docker-compose.prod.yaml: Code-bind-mount entfernt, nginx-proxy extends - approot.py: absolute Pfade, Debug-Modus via APP_DEBUG Umgebungsvariable - init.sh: vereinfacht (kein cd/pip, absolute Pfade) - inireader.mjs: absoluter Pfad fuer config.ini - package.json: scripts.build (tsc + rollup) ergaenzt - .dockerignore, deploy-kbcrm-test.sh, deploy-kbcrm-prod.sh erstellt - docker-compose.save.yaml geloescht - env-sample: BUILD_ENVIRONMENT nach oben, Dev-only Variablen markiert Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
31ef206bd8
commit
3b3e2893e5
14 files changed
+200
-91
No files matched your search
+28
-2
@@ -1,6 +1,32 @@
|
||||
ARG NGINX_VERSION
|
||||
ARG NODE_VERSION
|
||||
ARG NPM_VERSION
|
||||
|
||||
# ── Stage: frontend — baut das TypeScript-JS-Bundle ──────────────
|
||||
# Node.js, npm und node_modules landen NICHT im Prod-Image.
|
||||
FROM node:${NODE_VERSION}-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:${NGINX_VERSION}
|
||||
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
||||
RUN mkdir -p /etc/certs /etc/nginx/templates
|
||||
COPY 10-select-ssl.sh /docker-entrypoint.d/10-select-ssl.sh
|
||||
RUN chmod +x /docker-entrypoint.d/10-select-ssl.sh
|
||||
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/
|
||||
Reference in new issue
Block a user