112 lines
2.6 KiB
YAML
112 lines
2.6 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: kaia-yield-postgres
|
|
environment:
|
|
POSTGRES_DB: kaia_yield_ai
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./backend/migrations:/docker-entrypoint-initdb.d
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Redis Cache
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: kaia-yield-redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
command: redis-server --appendonly yes
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# Backend API
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: kaia-yield-backend
|
|
ports:
|
|
- "3001:3001"
|
|
environment:
|
|
NODE_ENV: development
|
|
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/kaia_yield_ai
|
|
REDIS_URL: redis://redis:6379
|
|
PORT: 3001
|
|
KAIA_TESTNET_RPC: https://public-en-baobab.klaytn.net
|
|
KAIA_MAINNET_RPC: https://public-en-cypress.klaytn.net
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./backend:/app
|
|
- /app/node_modules
|
|
command: npm run dev
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Frontend Application
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: kaia-yield-frontend
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
NEXT_PUBLIC_API_URL: http://localhost:3001/api
|
|
NEXT_PUBLIC_WS_URL: ws://localhost:3001
|
|
NEXT_PUBLIC_CHAIN_ID: 8217
|
|
NEXT_PUBLIC_RPC_URL: https://public-en-cypress.klaytn.net
|
|
depends_on:
|
|
- backend
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
- /app/.next
|
|
command: npm run dev
|
|
|
|
# Contract deployment (for development)
|
|
contracts:
|
|
build:
|
|
context: ./contracts
|
|
dockerfile: Dockerfile
|
|
container_name: kaia-yield-contracts
|
|
environment:
|
|
KAIA_TESTNET_RPC: https://public-en-baobab.klaytn.net
|
|
KAIA_MAINNET_RPC: https://public-en-cypress.klaytn.net
|
|
volumes:
|
|
- ./contracts:/app
|
|
- /app/node_modules
|
|
profiles:
|
|
- deploy
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
default:
|
|
name: kaia-yield-network |