fix(docker): manage local postgres in default compose

This commit is contained in:
caoxiaozhu
2026-07-17 22:50:02 +08:00
parent 787bc3a481
commit 07241b4648
6 changed files with 249 additions and 37 deletions

View File

@@ -3,6 +3,9 @@ services:
image: x-financial-dev:latest
container_name: local-x-financial-linux
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
WEB_HOST: 0.0.0.0
WEB_PORT: "${WEB_PORT:-5173}"
@@ -11,6 +14,12 @@ services:
SERVER_RELOAD: "${SERVER_RELOAD:-true}"
SERVER_VENV_DIR: /tmp/x-financial-server-venv
X_FINANCIAL_PREFER_ENV_FILE: "true"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DB: "${LOCAL_POSTGRES_DB:-x_financial}"
POSTGRES_USER: "${LOCAL_POSTGRES_USER:-x_financial}"
POSTGRES_PASSWORD: "${LOCAL_POSTGRES_PASSWORD:-x_financial}"
DATABASE_URL: "postgresql+psycopg://${LOCAL_POSTGRES_USER:-x_financial}:${LOCAL_POSTGRES_PASSWORD:-x_financial}@postgres:5432/${LOCAL_POSTGRES_DB:-x_financial}"
ONLYOFFICE_ENABLED: "${ONLYOFFICE_ENABLED:-false}"
ONLYOFFICE_PUBLIC_URL: "${ONLYOFFICE_PUBLIC_URL:-}"
ONLYOFFICE_BACKEND_URL: "${ONLYOFFICE_BACKEND_URL:-}"
@@ -65,6 +74,30 @@ services:
networks:
- financial-internal
postgres:
image: pgvector/pgvector:pg17
container_name: x-financial-local-postgres
restart: unless-stopped
environment:
POSTGRES_DB: "${LOCAL_POSTGRES_DB:-x_financial}"
POSTGRES_USER: "${LOCAL_POSTGRES_USER:-x_financial}"
POSTGRES_PASSWORD: "${LOCAL_POSTGRES_PASSWORD:-x_financial}"
ports:
- "127.0.0.1:${LOCAL_POSTGRES_HOST_PORT:-55432}:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
interval: 15s
timeout: 5s
retries: 10
start_period: 30s
networks:
- financial-internal
networks:
financial-internal:
name: financial-internal
volumes:
postgres-data: