-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
55 lines (51 loc) · 1.59 KB
/
docker-compose.yml
File metadata and controls
55 lines (51 loc) · 1.59 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
version: "3.8"
services:
# PostgreSQL 数据库
postgres:
image: postgres:16-alpine
container_name: paynote-db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?请在.env文件中设置POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB:-paynote}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
# PayNote 应用
app:
image: ${DOCKER_IMAGE:-paynote:latest}
build:
context: .
dockerfile: Dockerfile
container_name: paynote-app
restart: unless-stopped
ports:
- "${APP_PORT:-3000}:3000"
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-paynote}?schema=public
- AUTH_SECRET=${AUTH_SECRET:?请在.env文件中设置AUTH_SECRET}
- NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}
depends_on:
postgres:
condition: service_healthy
# 数据库迁移服务(一次性运行)
migrate:
image: ${DOCKER_IMAGE:-paynote:latest}
build:
context: .
dockerfile: Dockerfile.migrate
container_name: paynote-migrate
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-paynote}?schema=public
depends_on:
postgres:
condition: service_healthy
volumes:
postgres_data: