Optimierung der Projektstruktur: Entferne nicht mehr benötigte Skripte und Dateien, um die Wartbarkeit zu erhöhen und veraltete Komponenten zu beseitigen.

This commit is contained in:
2025-04-30 15:51:07 +02:00
parent 1c49ddfb19
commit de0f837cfd
3 changed files with 82 additions and 0 deletions

30
Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# Dockerfile
FROM python:3.11-slim
# Arbeitsverzeichnis in Container
WORKDIR /app
# Systemabhängigkeiten (falls erforderlich)
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc libpq-dev && \
rm -rf /var/lib/apt/lists/*
# pip auf den neuesten Stand bringen und Requirements installieren
COPY requirements.txt ./
RUN pip install --upgrade pip && \
pip install --no-cache-dir -U -r requirements.txt
# Anwendungscode kopieren
COPY . .
# Exponiere Port 5000 für Flask
EXPOSE 5000
# Setze Umgebungsvariablen
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
# Wenn eine .env im Arbeitsverzeichnis vorhanden ist, wird sie automatisch von Flask geladen
# Startkommando
CMD ["python", "app.py"]

30
docker-compose.yml Normal file
View File

@@ -0,0 +1,30 @@
version: '3.9'
services:
web:
build: .
image: systades_app:latest
container_name: systades_app
restart: always
env_file:
- .env
ports:
- "5000:5000"
volumes:
- .:/app:ro
depends_on:
- db
db:
image: postgres:15-alpine
container_name: systades_db
restart: always
env_file:
- .env
volumes:
- db_data:/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
db_data:

22
start.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -e
# Alte Container stoppen und entfernen
if [ $(docker ps -aq --filter "name=systades_app" | wc -l) -gt 0 ]; then
docker rm -f systades_app || true
fi
if [ $(docker ps -aq --filter "name=systades_db" | wc -l) -gt 0 ]; then
docker rm -f systades_db || true
fi
# Alte Images löschen
docker rmi -f systades_app:latest || true
# Docker-Compose Setup neu bauen
docker-compose build --no-cache
# Docker-Compose neu starten
docker-compose up -d --force-recreate
# Ausgabe
echo "Systades-Anwendung ist jetzt unter http://localhost:5000 erreichbar."