-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
58 lines (54 loc) · 1.54 KB
/
Copy pathdocker-compose.yml
File metadata and controls
58 lines (54 loc) · 1.54 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
# GameLink 开发环境 Docker Compose 配置
# 使用方式: docker-compose up -d
#
# 仅部署数据库服务,后端和前端本地运行:
# - 后端: cd api && go run cmd/main.go
# - 前端: cd admin && npm run dev
services:
# PostgreSQL 数据库
postgres:
image: postgres:16-alpine
container_name: gamelink-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-gamelink}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-gamelink123}
POSTGRES_DB: ${POSTGRES_DB:-gamelink}
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate=C --lc-ctype=C
ports:
- "${POSTGRES_PORT:-5433}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- gamelink-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gamelink} -d ${POSTGRES_DB:-gamelink}"]
interval: 5s
timeout: 5s
retries: 10
# Redis 缓存
redis:
image: redis:7-alpine
container_name: gamelink-redis
restart: unless-stopped
command: redis-server --appendonly yes --appendfsync everysec --maxmemory 256mb --maxmemory-policy allkeys-lru
ports:
- "${REDIS_PORT:-6380}:6379"
volumes:
- redis_data:/data
networks:
- gamelink-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
networks:
gamelink-network:
driver: bridge
name: gamelink-network
volumes:
postgres_data:
name: gamelink-postgres-data
redis_data:
name: gamelink-redis-data