-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
93 lines (76 loc) · 2.15 KB
/
Copy pathdocker-compose.yml
File metadata and controls
93 lines (76 loc) · 2.15 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
services:
# --- LogicPaper Core Service ---
# Hosts FastAPI Backend & LibreOffice Engine
logicpaper-app:
build:
context: .
dockerfile: Dockerfile
target: production
image: logicpaper:v1.4.1
container_name: logicpaper_core
restart: unless-stopped
security_opt:
- no-new-privileges:true
env_file:
- .env
ports:
- "127.0.0.1:8000:8000"
volumes:
# 1. Data Persistence:
# Maps local './data' to container '/data'
# Allows viewing generated ZIPs/PDFs from the host machine
- ./data:/data
# 2. Code Hot-Reloading (Development):
# Maps local source code to container paths
# Changes in Python or HTML reflect immediately without rebuilding
- ./app:/app/app
- ./static:/app/static
# 3. Templates Storage:
- ./persistent_templates:/app/persistent_templates
networks:
- logicpaper_internal
- logicpaper_public
depends_on:
# Ensures the app only starts after Redis
redis:
condition: service_healthy
# Resource Limits (Stability Guardrails)
# LibreOffice conversion is CPU/RAM intensive
# These limits prevent the container from crashing the host system
deploy:
resources:
limits:
cpus: '2.0' # Cap at 2 CPU cores
memory: 2G # Cap at 2GB RAM
reservations:
memory: 512M # Reserve minimal 512MB RAM
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# --- Redis ---
redis:
image: redis:7-alpine
container_name: logicpaper_redis
restart: always
networks:
- logicpaper_internal
volumes:
- redis_data:/data
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# --- Networking ---
networks:
logicpaper_internal:
internal: true
logicpaper_public:
driver: bridge
# --- Volumes ---
volumes:
redis_data: