-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGitHub Action Build Docker.yml
62 lines (55 loc) · 1.38 KB
/
GitHub Action Build Docker.yml
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
version: '3.8'
services:
backend:
build: Django
container_name: backend
ports:
- "8000:8000"
networks:
- appleblog_network
environment:
- DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,backend,SERVER_NAME
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=pYrdip-kevset-mihby2
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- REDIS_HOST=redis # 使用 Redis 容器名称作为主机名
- REDIS_PORT=6379 # Redis 端口号(内部通信)
depends_on:
- db
- redis # 新增 Redis 依赖
volumes:
- ./media/post_images:/app/media/post_images
web:
build: astro
container_name: web
ports:
- "3000:3000"
depends_on:
- backend
networks:
- appleblog_network
environment:
- API_URL=http://backend:8000/api/posts/
db:
image: postgres:latest
container_name: db
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=pYrdip-kevset-mihby2
volumes:
- ./postgres_data:/var/lib/postgresql/data
networks:
- appleblog_network
redis:
image: redis:latest # 使用官方 Redis 镜像
container_name: redis
networks:
- appleblog_network # 不暴露端口,只在网络内部通信
networks:
appleblog_network:
driver: bridge
volumes:
postgres_data: