This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: coffeechat
|
||||
POSTGRES_USER: coffeechat
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||
volumes:
|
||||
- coffeechat-db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U coffeechat"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
migrate:
|
||||
image: postgres:17-alpine
|
||||
depends_on:
|
||||
db: { condition: service_healthy }
|
||||
environment:
|
||||
PGPASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- ../server/migrations:/migrations:ro
|
||||
entrypoint: ["sh", "-c", "for f in /migrations/*.sql; do psql -h db -U coffeechat -d coffeechat -v ON_ERROR_STOP=1 -f \"$$f\"; done"]
|
||||
restart: "no"
|
||||
api:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: server/Dockerfile
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db: { condition: service_healthy }
|
||||
migrate: { condition: service_completed_successfully }
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 3000
|
||||
DATABASE_URL: postgres://coffeechat:${POSTGRES_PASSWORD}@db:5432/coffeechat
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
WECHAT_APP_ID: ${WECHAT_APP_ID}
|
||||
WECHAT_APP_SECRET: ${WECHAT_APP_SECRET}
|
||||
ADMIN_TOKEN: ${ADMIN_TOKEN}
|
||||
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL}
|
||||
UPLOAD_DIR: /app/uploads
|
||||
volumes:
|
||||
- coffeechat-uploads:/app/uploads
|
||||
ports:
|
||||
- "127.0.0.1:${COFFEECHAT_PORT:-3100}:3000"
|
||||
volumes:
|
||||
coffeechat-db:
|
||||
name: coffeechat-db
|
||||
coffeechat-uploads:
|
||||
name: coffeechat-uploads
|
||||
Reference in New Issue
Block a user