-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.react.yml
More file actions
118 lines (106 loc) · 3.11 KB
/
docker-compose.react.yml
File metadata and controls
118 lines (106 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Docker Compose for SKULD React Frontend + FastAPI Backend
# Runs PARALLEL to existing Streamlit on its own subdomain.
#
# Required env vars (set in .env or via deploy workflow):
# REACT_DOMAIN - e.g. "react-test.skuld-options.com"
# TRAEFIK_ENTRYPOINT - "web" or "websecure"
# POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_PORT
#
# Usage:
# docker compose -f docker-compose.react.yml up --build
services:
# --- FastAPI Backend (REST API) ---
skuld-api:
build:
context: .
dockerfile: Dockerfile.api
container_name: skuld-api
env_file:
- .env
environment:
- PYTHONUNBUFFERED=1
- TZ=Europe/Berlin
- SECRET_KEY=${SECRET_KEY:-change-me-in-production}
- POSTGRES_HOST=${POSTGRES_HOST:-postgres}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- POSTGRES_USER=${POSTGRES_USER:-admin}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB:-Skuld}
restart: unless-stopped
networks:
- web
- postgres_setup_default
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 128M
labels:
- "traefik.enable=true"
- "traefik.http.routers.skuld-api.rule=Host(`react-test.skuld-options.com`) && PathPrefix(`/api`)"
- "traefik.http.routers.skuld-api.entrypoints=web"
- "traefik.http.services.skuld-api.loadbalancer.server.port=8000"
- "traefik.docker.network=web"
# Direct port exposure as Traefik bypass (not strictly needed if Next.js rewrites work)
ports:
- "3101:8000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# --- React/Next.js Frontend ---
skuld-react:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: skuld-react
environment:
- NODE_ENV=production
- API_BACKEND_URL=http://skuld-api:8000
restart: unless-stopped
ports:
- "3100:3000"
networks:
- web
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
cpus: '0.25'
memory: 256M
reservations:
cpus: '0.05'
memory: 64M
labels:
- "traefik.enable=true"
- "traefik.http.routers.skuld-react.rule=Host(`react-test.skuld-options.com`)"
- "traefik.http.routers.skuld-react.entrypoints=web"
- "traefik.http.services.skuld-react.loadbalancer.server.port=3000"
- "traefik.docker.network=web"
# No Authelia middleware - React has its own JWT auth
- "traefik.http.routers.skuld-react.priority=1"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
web:
external: true
postgres_setup_default:
external: true