-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
73 lines (68 loc) · 1.74 KB
/
docker-compose.prod.yml
File metadata and controls
73 lines (68 loc) · 1.74 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
version: "3.9"
services:
db:
image: mysql:8.0
container_name: myblog-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-rootpwd}
MYSQL_DATABASE: ${DB_NAME:-myshkin451blog}
MYSQL_USER: ${DB_USER:-bloguser}
MYSQL_PASSWORD: ${DB_PASSWORD:-blogpass}
volumes:
- /data/mysql:/var/lib/mysql
networks:
- blog-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
backend:
image: ghcr.io/achernar-eridani/blog-backend:${TAG:-latest}
build:
context: .
dockerfile: Dockerfile
target: prod
container_name: myblog-backend
depends_on:
db:
condition: service_healthy
environment:
NODE_ENV: production
DB_HOST: db
DB_USER: ${DB_USER:-bloguser}
DB_PASSWORD: ${DB_PASSWORD:-blogpass}
DB_NAME: ${DB_NAME:-myshkin451blog}
JWT_SECRET: ${JWT_SECRET:?请设置 JWT_SECRET 环境变量}
PORT: 3000
BASE_URL: https://myshkin451.com
volumes:
- ./uploads:/app/uploads
networks:
- blog-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
frontend:
image: ghcr.io/achernar-eridani/blog-frontend:${TAG:-latest}
build:
context: ./client
dockerfile: Dockerfile
target: prod
container_name: myblog-frontend
depends_on:
- backend
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt:/etc/letsencrypt:ro
networks:
- blog-network
restart: unless-stopped
networks:
blog-network:
driver: bridge