Files
arcticnewone/docker-compose.yml
T
virtheart 4bef241544 feat: 新增 Nitro Server API 与 PostgreSQL 后端,接入用户系统/联系表单/资讯订阅
- server/api: 注册/登录/登出/会话恢复(JWT + httpOnly Cookie, bcrypt 密码哈希)
- server/api: 联系表单与资讯订阅入库,支持 SMTP 邮件通知(可选)
- 应用启动自动建表(幂等),docker-compose 新增 PostgreSQL 16 服务
- 前端移除全部 mock:user store、登录注册弹窗、联系表单、页脚订阅接入真实接口
- i18n 补充服务端错误码中英文案,移除 demoHint
- deploy: Deployment 环境变量(Secret 引用)、可选集群内 PostgreSQL(postgres.yaml)
- 新增 .env.example 与 README/deploy 文档更新
2026-08-06 06:49:14 +08:00

50 lines
1.7 KiB
YAML

services:
postgres:
# 国内可访问的 DaoCloud 镜像源(与 Dockerfile 一致)
image: docker.m.daocloud.io/library/postgres:16-alpine
container_name: arcticnewone-postgres
environment:
POSTGRES_DB: arcticnewone
POSTGRES_USER: arcticnewone
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-arcticnewone_dev_password}
ports:
# 宿主机 5433,避免与本机已有 PostgreSQL(5432/15432) 冲突
- "5433:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U arcticnewone -d arcticnewone"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
app:
# 生产与本地使用同一 SWR 镜像(团队规范)
image: swr.cn-north-4.myhuaweicloud.com/virtheart/arcticnewone:latest
container_name: arcticnewone
ports:
- "3100:3000"
environment:
- NODE_ENV=production
- HOST=0.0.0.0
- PORT=3000
# 数据库连接(compose 内通过服务名 postgres 访问)
- NUXT_DATABASE_URL=postgres://arcticnewone:${POSTGRES_PASSWORD:-arcticnewone_dev_password}@postgres:5432/arcticnewone
# JWT 签名密钥(生产必须覆盖)
- NUXT_JWT_SECRET=${JWT_SECRET:-dev-only-secret-change-in-production}
# SMTP 邮件通知(可选;不配置时表单/订阅仅入库)
- NUXT_SMTP_HOST=${SMTP_HOST:-}
- NUXT_SMTP_PORT=${SMTP_PORT:-465}
- NUXT_SMTP_USER=${SMTP_USER:-}
- NUXT_SMTP_PASS=${SMTP_PASS:-}
- NUXT_SMTP_FROM=${SMTP_FROM:-}
- NUXT_SMTP_CONTACT_TO=${SMTP_CONTACT_TO:-}
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
volumes:
postgres-data: