Files
XHChat/docker-compose.yml
T

62 lines
1.6 KiB
YAML

name: xhchat
services:
postgres:
image: postgres:18-alpine
environment:
POSTGRES_DB: xhchat
POSTGRES_USER: xhchat
POSTGRES_PASSWORD: ${XHCHAT_DB_PASSWORD:?Set XHCHAT_DB_PASSWORD in .env}
volumes:
- postgres:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U xhchat -d xhchat"]
interval: 5s
timeout: 3s
retries: 15
redis:
image: redis:8-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 15
api:
build:
context: ./server
args:
GOPROXY: ${XHCHAT_GOPROXY:-https://proxy.golang.org,direct}
environment:
XHCHAT_ADDR: 0.0.0.0:8080
DATABASE_URL: postgres://xhchat:${XHCHAT_DB_PASSWORD}@postgres:5432/xhchat?sslmode=disable
REDIS_URL: redis://redis:6379/0
XHCHAT_ENVELOPE_RETENTION: ${XHCHAT_ENVELOPE_RETENTION:-720h}
XHCHAT_ORIGINS: ${XHCHAT_WEB_ORIGIN:-http://127.0.0.1:8080},xhchat://app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://127.0.0.1:8080/readyz"]
interval: 5s
timeout: 3s
retries: 15
web:
build:
context: .
dockerfile: web/Dockerfile
depends_on:
api:
condition: service_healthy
ports:
- "127.0.0.1:${XHCHAT_PORT:-8080}:80"
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://127.0.0.1/readyz"]
interval: 5s
timeout: 3s
retries: 10
volumes:
postgres: