diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b04c051 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +__pycache__ +*.pyc +frontend/.env +frontend/dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..354c3b1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# --- 1. Frontend bauen --- +FROM node:20 AS frontend-build +WORKDIR /app +COPY frontend ./frontend +WORKDIR /app/frontend +RUN npm install && npm run build + +# --- 2. Backend-Stage --- +FROM python:3.13 +WORKDIR /app + +# Backend-Dateien korrekt kopieren +COPY backend/app.py ./backend/app.py +COPY backend/datenbankverbindung.py ./backend/datenbankverbindung.py +COPY backend/templates ./backend/templates +COPY backend/config ./config +COPY backend/requirements.txt ./requirements.txt + +# Frontend aus Build-Stage übernehmen +COPY --from=frontend-build /app/frontend/dist ./frontend/dist + +# Python-Abhängigkeiten installieren +RUN pip install --no-cache-dir -r requirements.txt + +# Flask starten +WORKDIR /app/backend +EXPOSE 5000 +CMD ["python", "app.py"] diff --git a/backend/app.py b/backend/app.py index 792cd7d..62ce5f0 100644 --- a/backend/app.py +++ b/backend/app.py @@ -157,4 +157,4 @@ def hash_md5(): if __name__ == '__main__': os.makedirs("config", exist_ok=True) - app.run(host='127.0.0.1', port=5000) + app.run(host='0.0.0.0', port=5000) diff --git a/backend/requirements.txt b/backend/requirements.txt index f041604..9ebfc05 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -3,3 +3,4 @@ flask-cors mysql-connector-python werkzeug>=2.3 PyJWT +python-dotenv \ No newline at end of file