JUNOHUB-test/docker-compose.yml
2026-02-13 20:37:45 +05:00

47 lines
1.5 KiB
YAML

services:
db:
# Use a Postgres image with pgvector preinstalled so we can enable the `vector` extension
image: pgvector/pgvector:pg17
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_DB:-dropshipping}
ports:
- "5444:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
# Ensure the pgvector extension is created on first database init
- ./prisma/init-pgvector.sql:/docker-entrypoint-initdb.d/init-pgvector.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
app:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "3000:3000"
env_file:
- .env
environment:
# Override DATABASE_URL to use internal docker network hostname
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-dropshipping}?schema=public
NODE_ENV: production
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
postgres_data: