-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
142 lines (134 loc) · 3.23 KB
/
docker-compose.prod.yml
File metadata and controls
142 lines (134 loc) · 3.23 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
version: '3.8'
services:
# SSL Certificate Manager
certbot:
image: certbot/certbot:latest
container_name: pidea-certbot
volumes:
- ./nginx/ssl:/etc/letsencrypt
- ./nginx/webroot:/var/www/html
command: >
certonly --webroot
--webroot-path=/var/www/html
--email ${SSL_EMAIL}
--agree-tos --no-eff-email
--domains ${SSL_DOMAIN}
--keep-until-expiring
depends_on:
- nginx-proxy
restart: unless-stopped
networks:
- pidea-network
# SSL Reverse Proxy with automatic certificate renewal
nginx-proxy:
build:
context: .
dockerfile: nginx/Dockerfile
image: fr4iser/pidea:nginx-proxy
container_name: pidea-nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/ssl:/etc/nginx/ssl
- ./nginx/webroot:/var/www/html
environment:
- SSL_DOMAIN=${SSL_DOMAIN}
- SSL_EMAIL=${SSL_EMAIL}
depends_on:
- pidea-frontend
- pidea-backend
restart: unless-stopped
networks:
- pidea-network
# SSL Certificate Renewal Service
certbot-renew:
image: certbot/certbot:latest
container_name: pidea-certbot-renew
volumes:
- ./nginx/ssl:/etc/letsencrypt
- ./nginx/webroot:/var/www/html
command: >
renew --webroot
--webroot-path=/var/www/html
--quiet
depends_on:
- nginx-proxy
restart: "no"
networks:
- pidea-network
# Database
pidea-db:
build:
context: ./database
dockerfile: Dockerfile
image: fr4iser/pidea:db
container_name: pidea-db
# No external ports - internal only
volumes:
- pidea-db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: pidea
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
env_file:
- .env
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d pidea"]
interval: 5s
timeout: 5s
retries: 15
start_period: 20s
networks:
- pidea-network
# Backend (no external ports)
pidea-backend:
build:
context: .
dockerfile: backend/Dockerfile
image: fr4iser/pidea:backend
container_name: pidea-backend
# No external ports - only accessible via proxy
depends_on:
pidea-db:
condition: service_healthy
environment:
DOCKER_ENV: "true"
NODE_ENV: "production"
env_file:
- .env
volumes:
- pidea-backend_logs:/app/logs
- /var/run/docker.sock:/var/run/docker.sock
- /tmp:/tmp
# Use host network for IDE connections
network_mode: "host"
restart: unless-stopped
# Frontend (no external ports)
pidea-frontend:
build:
context: .
dockerfile: frontend/Dockerfile
image: fr4iser/pidea:frontend
container_name: pidea-frontend
# No external ports - only accessible via proxy
# Use host network to access backend on localhost
network_mode: "host"
depends_on:
- pidea-backend
env_file:
- .env
volumes:
- pidea-frontend_logs:/var/log/nginx
restart: unless-stopped
volumes:
pidea-db-data:
driver: local
pidea-backend_logs:
driver: local
pidea-frontend_logs:
driver: local
networks:
pidea-network:
driver: bridge