-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
153 lines (141 loc) · 3.7 KB
/
docker-compose.yaml
File metadata and controls
153 lines (141 loc) · 3.7 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
services:
app:
profiles:
- prod:push
- prod
- dev
build:
context: .
dockerfile: Dockerfile
image: ${DOCKER_USERNAME}/${PACKAGE_NAME}:${PACKAGE_VERSION}
container_name: ${PACKAGE_NAME}_api
environment:
- PORT=${PORT}
- NODE_ENV=${NODE_ENV}
- EMAIL=${EMAIL}
- BASE_URL=${BASE_URL}
- HOST_PROJECT_ROOT=${PWD}
ports:
- "5000:${PORT}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./temp:/app/temp
networks:
- default
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${PORT}/"]
interval: 30s # Check every 15 seconds (more frequent)
timeout: 15s # 10 second timeout
retries: 3 # 3 retries before marking unhealthy
start_period: 30s # Wait 30 seconds before starting health checks
# Add logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Add labels for better container management
labels:
- "app.name=${PACKAGE_NAME}"
- "app.version=${PACKAGE_VERSION}"
- "deployment.type=zero-downtime"
nginx:
profiles:
- prod
image: nginx:alpine
container_name: ${PACKAGE_NAME}_nginx
depends_on:
- app
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/certbot/www:/var/www/certbot
- ./nginx/certbot/conf:/etc/letsencrypt
- ./nginx/selfsigned:/etc/nginx/selfsigned
ports:
- "80:80"
- "443:443"
networks:
- default
restart: always
certbot:
profiles:
- prod
image: certbot/certbot
container_name: ${PACKAGE_NAME}_certbot
volumes:
- ./nginx/certbot/www:/var/www/certbot
- ./nginx/certbot/conf:/etc/letsencrypt
environment:
- EMAIL=${EMAIL}
- BASE_URL=${BASE_URL}
entrypoint: >
certbot certonly --webroot --webroot-path=/var/www/certbot
--email ${EMAIL} --agree-tos --no-eff-email
-d ${BASE_URL}
depends_on:
- nginx
networks:
- default
restart: "no"
certbot-renew:
profiles:
- prod
image: certbot/certbot
container_name: ${PACKAGE_NAME}_certbot_renew
volumes:
- ./nginx/certbot/www:/var/www/certbot
- ./nginx/certbot/conf:/etc/letsencrypt
entrypoint: >
sh -c "trap exit TERM;
while :; do
echo '🔄 Checking for SSL renewal...';
certbot renew --webroot --webroot-path=/var/www/certbot --quiet --deploy-hook 'nginx -s reload';
sleep 12h;
done"
depends_on:
- nginx
networks:
- default
restart: unless-stopped
# ====================== language image ====================== #
nodejs-image:
profiles:
- prod
build:
context: .
dockerfile: docker/Dockerfile.nodejs
image: executor-nodejs:latest
deno-image:
profiles:
- prod
build:
context: .
dockerfile: docker/Dockerfile.deno
image: executor-deno:latest
python-image:
profiles:
- prod
build:
context: .
dockerfile: docker/Dockerfile.python
image: executor-python:latest
java-image:
profiles:
- prod
build:
context: .
dockerfile: docker/Dockerfile.jvm
image: executor-java:latest
kotlin-image:
profiles:
- prod
build:
context: .
dockerfile: docker/Dockerfile.kotlin
image: executor-kotlin:latest
networks:
default:
name: ${PACKAGE_NAME}_network
labels:
- "project=${PACKAGE_NAME}"