c32f3e12ec
update env.example, add docker-compose.yml for start all services
66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
# Полный стек: docker compose up --build -d → web :3000, api :3001, postgres :5434 (хост)
|
|
# Только БД: docker compose up -d postgres
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: brandbook_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: brandbook
|
|
POSTGRES_PASSWORD: brandbook
|
|
POSTGRES_DB: brandbook
|
|
ports:
|
|
- "5434:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U brandbook -d brandbook"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/Dockerfile.api
|
|
container_name: brandbook_api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3001:3001"
|
|
environment:
|
|
DATABASE_URL: postgresql://brandbook:brandbook@postgres:5432/brandbook
|
|
PORT: "3001"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD-SHELL",
|
|
"wget -qO- http://127.0.0.1:3001/ >/dev/null || exit 1",
|
|
]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 40s
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/Dockerfile.web
|
|
args:
|
|
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:3001}
|
|
container_name: brandbook_web
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
PORT: "3000"
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
postgres_data:
|