-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompose.yml
More file actions
217 lines (200 loc) · 5.55 KB
/
compose.yml
File metadata and controls
217 lines (200 loc) · 5.55 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# Docker Compose for Video Subtitle Generator
# Using modern Compose specification v3.9+ with 2025 best practices
# Compatible with Docker Compose v2.32+ and Docker Engine v28+
name: video-subtitle-generator
services:
subtitle-generator:
build:
context: .
dockerfile: Dockerfile
tags:
- video-subtitle-generator:latest
- video-subtitle-generator:${VERSION:-latest}
image: video-subtitle-generator:latest
container_name: video-subtitle-generator
restart: unless-stopped
environment:
# Application settings
LOG_LEVEL: INFO
PYTHONUNBUFFERED: "1"
ENV: production
# Google Cloud settings (optional - can use service account file instead)
# GOOGLE_APPLICATION_CREDENTIALS: /app/service-account.json
# GCP_PROJECT_ID: your-project-id
volumes:
# Input/Output directories - map to your local directories
- type: bind
source: ./input
target: /app/input
read_only: false
- type: bind
source: ./output
target: /app/output
read_only: false
- type: bind
source: ./logs
target: /app/logs
read_only: false
- type: bind
source: ./temp
target: /app/temp
read_only: false
- type: bind
source: ./jobs
target: /app/jobs
read_only: false
# Service account credential (optional)
- type: bind
source: ./service-account.json
target: /app/service-account.json
read_only: true
# Optional: Mount local development code for hot reload
# - type: bind
# source: ./src
# target: /app/src
# read_only: true
ports:
# Web interface port (if implemented)
- target: 8080
published: 8080
protocol: tcp
mode: host
# Resource limits for production
deploy:
resources:
limits:
memory: 8G
cpus: '4'
reservations:
memory: 2G
cpus: '1'
# Health check
healthcheck:
test:
- CMD
- python
- -c
- "from src.health_checker import quick_health_check; h=quick_health_check(); exit(0 if h['overall_status'] in ['healthy','warning'] else 1)"
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
start_interval: 5s
# Run in interactive mode by default
stdin_open: true
tty: true
# Security settings
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
# Override command examples:
# command: ["python", "main.py", "--help"]
# command: ["python", "main.py", "--video", "input/video.mp4", "--languages", "eng,hin"]
# command: ["python", "main.py", "--batch", "input/"]
# Optional: Add monitoring stack - Updated 2025 versions
prometheus:
image: prom/prometheus:v2.58.0
container_name: subtitle-prometheus
ports:
- target: 9090
published: 9090
protocol: tcp
mode: host
volumes:
- type: bind
source: ./monitoring/prometheus.yml
target: /etc/prometheus/prometheus.yml
read_only: true
- type: volume
source: prometheus_data
target: /prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=30d
- --web.console.libraries=/etc/prometheus/console_libraries
- --web.console.templates=/etc/prometheus/consoles
- --web.enable-lifecycle
profiles:
- monitoring
security_opt:
- no-new-privileges:true
user: "65534:65534"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
grafana:
image: grafana/grafana:11.5.0
container_name: subtitle-grafana
ports:
- target: 3000
published: 3000
protocol: tcp
mode: host
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
GF_USERS_ALLOW_SIGN_UP: "false"
GF_SECURITY_DISABLE_GRAVATAR: "true"
GF_USERS_DEFAULT_THEME: light
GF_LOG_LEVEL: warn
GF_SECURITY_COOKIE_SECURE: "true"
GF_SECURITY_COOKIE_SAMESITE: strict
volumes:
- type: volume
source: grafana_data
target: /var/lib/grafana
- type: bind
source: ./monitoring/grafana/dashboards
target: /etc/grafana/provisioning/dashboards
read_only: true
- type: bind
source: ./monitoring/grafana/datasources
target: /etc/grafana/provisioning/datasources
read_only: true
depends_on:
prometheus:
condition: service_healthy
restart: true
profiles:
- monitoring
security_opt:
- no-new-privileges:true
user: "472:472"
restart: unless-stopped
healthcheck:
test:
- CMD-SHELL
- "curl -f http://localhost:3000/api/health || exit 1"
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
prometheus_data:
driver: local
driver_opts:
type: none
o: bind
device: ./monitoring/prometheus
grafana_data:
driver: local
driver_opts:
type: none
o: bind
device: ./monitoring/grafana
networks:
default:
name: subtitle-generator-network
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16