-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
59 lines (55 loc) · 1.93 KB
/
docker-compose.yml
File metadata and controls
59 lines (55 loc) · 1.93 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
version: '3.8'
services:
postgres:
profiles: ["docker-db"] # Only run this service when the 'docker-db' profile is activated
image: ankane/pgvector:latest # Use the available 'latest' tag
restart: always
environment:
# These values are used when the docker-db profile is active
# They should be defined in the server's .env file if DATABASE_URL is NOT set
POSTGRES_DB: ${POSTGRES_DB:-dreamhub_db}
POSTGRES_USER: ${POSTGRES_USER:-user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
volumes:
- postgres_data:/var/lib/postgresql/data
# This mount requires init_db.sql to be present in /root/dreamhub on the server
- ./init_db.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "5433:5432" # Map host port 5433 to container port 5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-user} -d ${POSTGRES_DB:-dreamhub_db}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
restart: always
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
app:
# Using the specific image built and pushed by CI
image: ghcr.io/soaringjerry/dreamhub:latest
restart: always
depends_on: # Removed postgres dependency, app should handle connection based on DATABASE_URL
redis:
condition: service_healthy
# 从服务器本地的 .env 文件加载环境变量
env_file:
- .env
ports:
# 将主机的 8080 端口映射到容器的 8080 端口 (Dockerfile 中 EXPOSE 的端口)
- "8080:8080"
volumes:
# 如果应用需要持久化存储上传的文件
- uploads:/app/uploads
volumes:
postgres_data: # Keep volume definition even if service is profiled
redis_data:
uploads: # 如果定义了上面的 app volume,这里也要定义