From 4206c57478a0a76a1f28aa5f2a61507ce9a304e2 Mon Sep 17 00:00:00 2001 From: weishen Date: Mon, 6 Apr 2026 18:59:01 +0800 Subject: [PATCH] update docker-compose.yml for build --- docker-compose.yml | 54 +++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0b76b74..074e21c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,30 +1,50 @@ services: + db: + image: timescale/timescaledb:latest-pg17 + container_name: agentbase-db + environment: + POSTGRES_DB: openclaw_archive + POSTGRES_USER: openclaw + POSTGRES_PASSWORD: openclaw_archive_pass + volumes: + - ./db_data:/var/lib/postgresql/data + - ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro + ports: + - "5432:5432" + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U openclaw"] + interval: 10s + timeout: 5s + retries: 5 + web: build: context: . dockerfile: Dockerfile - container_name: openclaw-archive + container_name: agentbase-web env_file: - .env + environment: + DB_HOST: db + DB_PORT: 5432 + DB_NAME: openclaw_archive + DB_USER: openclaw + DB_PASSWORD: openclaw_archive_pass ports: - - "${DJANGO_PORT:-6789}:${DJANGO_PORT:-8000}" + - "8000:8000" volumes: - - static_volume:/app/staticfiles - - jsonl_archive:/app/archive + - ./static_volume:/app/staticfiles + depends_on: + db: + condition: service_healthy restart: unless-stopped - - # nginx placeholder (uncomment for production) - # nginx: - # image: nginx:alpine - # container_name: openclaw-nginx - # ports: - # - "80:80" - # volumes: - # - ./nginx/nginx.conf:/etc/nginx/nginx.conf - # - static_volume:/app/staticfiles:ro - # depends_on: - # - web + command: > + sh -c "python manage.py migrate && + python manage.py createsuperuser --noinput || + true && + gunicorn --bind 0.0.0.0:8000 --workers 2 --timeout 120 config.wsgi:application" volumes: + db_data: static_volume: - jsonl_archive: