Commit 5c6a3b89 authored by Gezer's avatar Gezer
Browse files

Added Dockerfiles and compose so we can start the

project with docker compose up --build
modified urls.py sim->app
No related merge requests found
Showing with 63 additions and 3 deletions
+63 -3
# Verwende das neueste Python-Image
FROM python:latest
# Setze das Arbeitsverzeichnis im Container
WORKDIR /app
# Kopiere die pyproject.toml und uv.lock-Dateien
COPY pyproject.toml .
COPY uv.lock .
# Kopiere auch requirements.txt, falls vorhanden
COPY requirements.txt .
# Installiere uv und die Abhängigkeiten
RUN pip install --upgrade pip && \
pip install uv && \
pip install --no-cache-dir -r requirements.txt
# Kopiere den Rest des Projekts in den Container
COPY . .
# Setze Umgebungsvariablen, falls nötig
ENV PYTHONUNBUFFERED 1
# Exponiere den Port 8000 für den Server
EXPOSE 8000
# Der Startbefehl: Starte den Server mit uv
CMD ["uv", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]
......@@ -32,7 +32,7 @@ def login_view(request):
user = authenticate(request, username=email, password=password)
if user:
login(request, user)
login(request, user) # also creates a session in the browser
return JsonResponse({"success": True})
return JsonResponse(
{"success": False, "message": "Invalid credentials"}, status=401
......@@ -40,7 +40,7 @@ def login_view(request):
def logout_view(request):
logout(request)
logout(request)
return JsonResponse({"message": "Logged out"})
......
......@@ -20,5 +20,5 @@ from django.urls import path, include
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("sim.urls")),
path("", include("app.urls")),
]
version: '3.9'
services:
backend:
build: ./backend
ports:
- "8000:8000"
volumes:
- ./backend:/app
frontend:
build: ./frontend
ports:
- "5173:5173"
volumes:
- ./frontend:/app
stdin_open: true
tty: true
# frontend/Dockerfile
FROM node:20
WORKDIR /app
# Nur lokale Abhängigkeiten, kein globales Vite!
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npx", "vite", "--host"]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment