Add Nginx frontend + Backend Docker setup for Coolify deployment
This commit is contained in:
@@ -1,16 +1,8 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY requirements.txt .
|
||||||
# Kein Systemd, keine Ports 80/443 - alles clean nach Coolify-Regeln
|
|
||||||
|
|
||||||
COPY backend/requirements.txt .
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
COPY . .
|
||||||
COPY backend/ .
|
|
||||||
|
|
||||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
+12
-11
@@ -1,24 +1,25 @@
|
|||||||
services:
|
services:
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ./backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile.backend
|
||||||
image: wochenplaner-backend:latest
|
image: wochenplaner-backend:latest
|
||||||
container_name: wochenplaner
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# Kein ports: 80/443 - Traefik belegt diese
|
|
||||||
# Port 8000 für API - identischer Host/Container-Port
|
|
||||||
ports:
|
|
||||||
- "8000:8000"
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- PORT=8000
|
- PORT=8000
|
||||||
- JWT_SECRET=${JWT_SECRET:-wochenplaner-jwt-secret-change-me}
|
- JWT_SECRET=${SERVICE_BASE64_64_JWT:-wochenplaner-jwt-secret-change-me}
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- wochenplaner_data:/app/data
|
- wochenplaner_data:/app/data
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: nginx:alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
volumes:
|
||||||
|
- ./frontend:/var/www/html:ro
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
wochenplaner_data:
|
wochenplaner_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
|||||||
+1666
File diff suppressed because it is too large
Load Diff
+28
@@ -0,0 +1,28 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
# Frontend static files
|
||||||
|
root /var/www/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# API reverse proxy zum Backend
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend:8000/api/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /health {
|
||||||
|
proxy_pass http://backend:8000/health;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Alles andere → index.html (SPA fallback)
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user