Files
backend_v2/scripts/pgvector/docker-compose.yml
toom1996 766c691eb3 update
2026-09-17 10:10:10 +08:00

35 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# docker-compose.yml — PostgreSQL 16 + pgvector (Docker)
#
# 数据持久化在命名卷 pgvector_data;首次初始化时 initdb/01-extensions.sql
# 会自动 CREATE EXTENSION vector。端口 5432 映射到宿主机 localhost,
# 与 Go 后端用 postgres://fashion:fashion_dev_2026@localhost:5432/fashion 连接。
#
# 管理:
# 启动 : docker compose up -d
# 停止 : docker compose stop
# 重建 : docker compose down && docker compose up -d (不动数据卷则数据不丢)
# 清数据: docker compose down -v
services:
pgvector:
image: ankane/pgvector:latest # 预编译好 pgvector 的 PG 镜像;latest 当前底层为 PG17,对去重无影响
container_name: pgvector
restart: unless-stopped
environment:
POSTGRES_USER: fashion
POSTGRES_PASSWORD: fashion_dev_2026 # 仅本地开发;生产务必换强密码
POSTGRES_DB: fashion
ports:
- "5432:5432"
volumes:
- pgvector_data:/var/lib/postgresql/data
- ./initdb:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fashion -d fashion"]
interval: 5s
timeout: 3s
retries: 10
volumes:
pgvector_data: