first commit

This commit is contained in:
Michael Dong
2026-02-05 11:24:40 +08:00
commit a98e12f286
144 changed files with 26459 additions and 0 deletions

60
docker-compose.prod.yml Normal file
View File

@@ -0,0 +1,60 @@
version: "3.8"
services:
postgres:
image: postgres:16-alpine
container_name: notify-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-notify}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
POSTGRES_DB: ${POSTGRES_DB:-notify}
volumes:
- postgres_data:/var/lib/postgresql/data
# 生产环境不对外暴露数据库端口
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-notify} -d ${POSTGRES_DB:-notify}"]
interval: 5s
timeout: 5s
retries: 5
backend:
build:
context: ./backend_rust
dockerfile: Dockerfile
container_name: notify-backend
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-notify}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-notify}
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
BASE_URL: ${BASE_URL:-https://notify.example.com}
ports:
- "127.0.0.1:4000:4000"
volumes:
- uploads_data:/app/uploads
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
# 构建时注入 API URL用于 Next.js 静态优化)
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-}
container_name: notify-frontend
restart: unless-stopped
depends_on:
- backend
environment:
# 运行时 API URL用于 SSR
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-}
ports:
- "127.0.0.1:3000:3000"
volumes:
postgres_data:
uploads_data: