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:
gg committed 2026-09-13 18:40:55 +02:00
1 parent 31ef206bd8
commit 3b3e2893e5
14 files changed
+200 -91

No files matched your search

+18 -15
View File
@@ -1,6 +1,10 @@
ARG PYTHON_VERSION
ARG NODE_VERSION
ARG NPM_VERSION
# ── Stage: prod ──────────────────────────────────────────────────
# Build-Context ist das Repo-Root (.), daher muessen alle COPY-Pfade
# mit App_Server/ praefigiert werden.
FROM python:${PYTHON_VERSION} AS prod
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
RUN apt-get clean && apt-get update && apt-get install -y locales
@@ -12,15 +16,19 @@ RUN locale-gen
RUN mkdir -p /usr/opt/pythonapp/App_Server/root /usr/opt/pythonapp/env /usr/var/pythonappdata
WORKDIR /usr/opt/pythonapp
RUN python -m venv --upgrade-deps /usr/opt/pythonapp/env
COPY root/requirements.txt /usr/opt/pythonapp/App_Server/root/requirements.txt
COPY App_Server/root/requirements.txt /usr/opt/pythonapp/App_Server/root/requirements.txt
RUN /usr/opt/pythonapp/env/bin/pip install --no-cache-dir --upgrade pip -r /usr/opt/pythonapp/App_Server/root/requirements.txt
# COPY scripts/init.sh /init.sh
# RUN chmod 552 /init.sh
# # ENTRYPOINT [ "/init.sh" ]
# ENTRYPOINT [ "sh", "/init.sh" ]
# CMD []
# Python-Anwendungscode ins Image kopieren (inkl. templates/index.html)
COPY App_Server/root/ /usr/opt/pythonapp/App_Server/root/
# Prod-Start-Script
COPY App_Server/scripts/init.sh /usr/opt/pythonapp/App_Server/scripts/init.sh
RUN chmod +x /usr/opt/pythonapp/App_Server/scripts/init.sh
ENTRYPOINT ["sh", "/usr/opt/pythonapp/App_Server/scripts/init.sh"]
# ── Stage: dev ───────────────────────────────────────────────────
FROM prod AS dev
ARG NODE_VERSION
ARG NPM_VERSION
@@ -41,19 +49,14 @@ RUN apt-get update && \
&& rm -rf /var/lib/apt/lists/*
# --- 3. Node.js + npm installieren ---
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
apt-get install -y nodejs && \
npm install -g npm@${NPM_VERSION}
# --- 8. Arbeitsverzeichnis für TypeScript ---
# In dem Entwicklungsverzeichnis (PYTHON_DEV_DIR) existiert dies schon als Unterverzeichnis "Client", daher wird es hier nicht erstellt
# --- 4. Dev-Start-Script kopieren (fuer Konsistenz, wird sonst per bind-mount bereitgestellt) ---
COPY App_Server/scripts/inittypescriptdev.sh /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh
RUN chmod +x /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh
# --- 9. TypeScript + Rollup installieren ---
# Das Script inittypescriptdev.sh wird in der Entwicklungsumgebung ausgeführt, um die TypeScript-Umgebung zu initialisieren.
# Daher ist es nicht notwendig, es hier zu kopieren und auszuführen.
# COPY ./scripts/inittypescriptdev.sh /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh
# RUN chmod +x /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh
ENTRYPOINT ["sh", "/usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh"]
CMD ["/usr/opt/pythonapp/env/bin/python", "root/runserver.py", "-D"]
CMD ["/usr/opt/pythonapp/env/bin/python", "/usr/opt/pythonapp/App_Server/root/runserver.py", "-D"]