gendesign/tradein-mvp/docker-compose.yml
lekss361 02267d0306 feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in)
- FastAPI backend: PostGIS estimator + 3 scrapers (Avito/Cian/Yandex)
- Next.js 15 frontend: tradein.html mockup design, basePath=/trade-in
- WeasyPrint PDF (Брусника-style 4-page report)
- Address autocomplete с typo-tolerance + 6 EKB presets
- Изолированный docker stack gendesign-tradein (отдельная postgres БД)
- Caddy inline routes: gendsgn.ru/trade-in/* и /trade-in/api/v1/*
- Forgejo Actions: .forgejo/workflows/deploy-tradein.yml (shell-based GHCR login)
- Триггер только по paths: tradein-mvp/** (не пересекается с deploy.yml)
- Образы: ghcr.io/lekss361/gendesign-tradein-{backend,frontend}:latest

Первый запуск на сервере (вручную, один раз):
  - создать /opt/gendesign/tradein-mvp/.env.runtime (postgres pwd, contact email)
  - docker network create gendesign_shared (если нет)
  - docker compose -p gendesign-tradein up -d
  - docker compose -p gendesign exec caddy caddy reload
2026-05-21 00:25:39 +03:00

88 lines
2.8 KiB
YAML
Raw Permalink 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.

# Trade-In MVP — локальный стек для разработки.
#
# Архитектура зеркалит прод gendesign (Caddy -> frontend / backend / postgres),
# но всё локально без TLS — открывать http://localhost:8080
#
# Запуск:
# docker compose up -d --build
#
# Проверки:
# curl http://localhost:8080/health # backend health через Caddy
# open http://localhost:8080 # frontend (auto-redirect → /trade-in)
# open http://localhost:8080/preview/ # tradein.html mockup для сравнения
name: tradein-mvp
services:
postgres:
image: postgis/postgis:16-3.4-alpine
container_name: tradein-postgres
restart: unless-stopped
environment:
POSTGRES_USER: tradein
POSTGRES_PASSWORD: tradein
POSTGRES_DB: tradein
volumes:
- postgres-data:/var/lib/postgresql/data
# SQL init scripts: 001_trade_in_estimates.sql создаст таблицу при первом старте.
- ./backend/data/sql:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tradein -d tradein"]
interval: 5s
timeout: 3s
retries: 10
ports:
- "127.0.0.1:5433:5432" # local port 5433, чтобы не конфликтовать с прод-туннелем 15432
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: tradein-backend
restart: unless-stopped
environment:
DATABASE_URL: postgresql+psycopg://tradein:tradein@postgres:5432/tradein
CORS_ORIGINS: '["http://localhost:8080","http://localhost:3000"]'
ENVIRONMENT: dev
depends_on:
postgres:
condition: service_healthy
volumes:
# Hot-reload: монтируем app/ в runner, uvicorn --reload подхватит изменения.
- ./backend/app:/app/app:ro
ports:
- "127.0.0.1:8000:8000" # для прямого debug-доступа в обход Caddy
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: tradein-frontend
restart: unless-stopped
environment:
BACKEND_URL: http://backend:8000
NODE_ENV: production
depends_on:
- backend
ports:
- "127.0.0.1:3000:3000" # для прямого debug-доступа в обход Caddy
caddy:
image: caddy:2-alpine
container_name: tradein-caddy
restart: unless-stopped
ports:
- "127.0.0.1:8080:80" # главный entry point — http://localhost:8080
volumes:
- ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro
- ./frontend/public:/srv/preview:ro # для /preview/tradein.html mockup
- caddy-data:/data
- caddy-config:/config
depends_on:
- frontend
- backend
volumes:
postgres-data:
caddy-data:
caddy-config: