- VERSION 文件:版本号单一来源(当前 1.0.0)
- docker-compose.hub.yml / app.yml:镜像 tag 改为 \${IMAGE_TAG:-latest}
- scripts/publish.sh:自动读取 VERSION、打双标签(x.y.z + latest)、推送到 Docker Hub
39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
# docker-compose.hub.yml
|
||
# 使用 Docker Hub 镜像部署(含自带 PostgreSQL)
|
||
# 适合:全新服务器,无现有数据库
|
||
#
|
||
# 启动:IMAGE_TAG=1.0.0 docker compose -f docker-compose.hub.yml up -d
|
||
# 更新:IMAGE_TAG=1.1.0 docker compose -f docker-compose.hub.yml pull && docker compose -f docker-compose.hub.yml up -d
|
||
# 不指定 IMAGE_TAG 时默认使用 latest
|
||
|
||
services:
|
||
app:
|
||
image: touwaeriol/sub2apipay:${IMAGE_TAG:-latest}
|
||
ports:
|
||
- '${APP_PORT:-3001}:3000'
|
||
env_file: .env
|
||
environment:
|
||
- DATABASE_URL=postgresql://sub2apipay:${DB_PASSWORD:-password}@db:5432/sub2apipay
|
||
depends_on:
|
||
db:
|
||
condition: service_healthy
|
||
restart: unless-stopped
|
||
|
||
db:
|
||
image: postgres:16-alpine
|
||
environment:
|
||
POSTGRES_USER: sub2apipay
|
||
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
|
||
POSTGRES_DB: sub2apipay
|
||
volumes:
|
||
- pgdata:/var/lib/postgresql/data
|
||
healthcheck:
|
||
test: ['CMD-SHELL', 'pg_isready -U sub2apipay']
|
||
interval: 5s
|
||
timeout: 5s
|
||
retries: 10
|
||
restart: unless-stopped
|
||
|
||
volumes:
|
||
pgdata:
|