Files
o2o-weather/compose.yaml
T

110 lines
2.7 KiB
YAML

name: o2o-weather
services:
# 운영형: docker compose up --build → http://localhost:8080
frontend:
build:
context: ./frontend
target: prod
args:
# 비우면 같은 주소의 /v1 로 부르고 nginx 가 backend 로 넘긴다
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-}
# 공유·링크 미리보기(og:image)에 나가는 우리 주소
VITE_SITE_URL: ${VITE_SITE_URL:-https://weather.o2o.kr}
ports:
- "${FRONT_PORT:-8080}:80"
restart: unless-stopped
# 개발형: docker compose --profile dev up --build frontend-dev → http://localhost:5173
frontend-dev:
profiles: ["dev"]
build:
context: ./frontend
target: dev
ports:
- "5173:5173"
volumes:
- ./frontend:/app
- /app/node_modules
environment:
- CHOKIDAR_USEPOLLING=true
- VITE_SITE_URL=${VITE_SITE_URL:-https://weather.o2o.kr}
# 백엔드 API: http://localhost:9810/docs
backend:
build: ./backend
command: ["python", "web_main.py"]
env_file: .env
environment:
PORT: "9800"
DB_HOST: postgres
DB_PORT: "5432"
REDIS_HOST: redis
REDIS_PORT: "6379"
ports:
- "${API_BIND:-9810}:9800"
volumes:
- uploads:/app/uploads # 사람 글 사진
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# 매일 03:00 스케줄 1개 (포트 없음)
worker:
build: ./backend
command: ["python", "worker_main.py"]
env_file: .env
environment:
DB_HOST: postgres
DB_PORT: "5432"
REDIS_HOST: redis
REDIS_PORT: "6379"
healthcheck:
disable: true
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
postgres:
image: pgvector/pgvector:pg16
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
ports:
- "${PG_BIND:-5440}:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./backend/postgres-init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
ports:
- "${REDIS_BIND:-6390}:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
volumes:
pgdata:
redisdata:
uploads: