-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
98 lines (92 loc) · 2.66 KB
/
docker-compose.prod.yml
File metadata and controls
98 lines (92 loc) · 2.66 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
version: '3.8'
services:
# Production MySQL Database (isolated on internal network only)
mysql-prod:
image: mysql:8.0
container_name: meteo-mysql-prod
restart: unless-stopped
env_file:
- .env.production
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- mysql_prod_data:/var/lib/mysql
- ./database/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
- ./database/seed.sql:/docker-entrypoint-initdb.d/02-seed.sql
networks:
- meteo-internal
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u${DB_USER}", "-p${DB_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
# Backend API Service (dual network: internal + NPM)
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: meteo-backend-prod
restart: unless-stopped
env_file:
- .env.production
environment:
NODE_ENV: production
PORT: 5001
DB_HOST: mysql-prod
DB_PORT: 3306
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
OPENWEATHER_API_KEY: ${OPENWEATHER_API_KEY}
VISUAL_CROSSING_API_KEY: ${VISUAL_CROSSING_API_KEY}
METEO_ANTHROPIC_API_KEY: ${METEO_ANTHROPIC_API_KEY}
CORS_ORIGIN: https://meteo-beta.tachyonfuture.com
JWT_SECRET: ${JWT_SECRET}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
depends_on:
mysql-prod:
condition: service_healthy
networks:
- meteo-internal
- npm_network
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://127.0.0.1:5001/api/health"]
interval: 30s
timeout: 10s
retries: 3
# Frontend Web Service (NPM network only)
frontend:
env_file:
- .env.production
build:
context: ./frontend
dockerfile: Dockerfile.prod
args:
VITE_API_URL: https://api.meteo-beta.tachyonfuture.com/api
VITE_OPENWEATHER_API_KEY: ${OPENWEATHER_API_KEY}
container_name: meteo-frontend-prod
restart: unless-stopped
depends_on:
- backend
networks:
- npm_network
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://127.0.0.1:80"]
interval: 30s
timeout: 10s
retries: 3
volumes:
mysql_prod_data:
name: meteo_mysql_prod_data
networks:
# Internal network for MySQL <-> Backend communication (isolated)
meteo-internal:
driver: bridge
name: meteo-internal
# External NPM network for proxy access
npm_network:
external: true
name: npm_network