add docker files

This commit is contained in:
Marcus Almert
2025-10-28 12:18:48 +01:00
parent d793462ace
commit dbf54f59ef
6 changed files with 74 additions and 4 deletions

16
backend/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM python:3.11-slim
WORKDIR /app
# Dependencies installieren
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Source-Code kopieren
COPY src/ ./src
# Port öffnen
EXPOSE 8000
# FastAPI starten (Uvicorn)
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -1,5 +1,6 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import os
app = FastAPI()
@@ -13,4 +14,10 @@ app.add_middleware(
@app.get("/api/hello")
def read_root():
return {"message": "Hallo von FastAPI 🎉"}
return {"message": "Hallo von FastAPI 🎉"}
@app.get("/api/versions")
def read_root():
message = os.popen("python --version").read().strip()
return {"message": message}