version: '3.8' x-app: &app build: dockerfile: ./Dockerfile restart: unless-stopped working_dir: /app volumes: - .:/app/oms-odoo # 將本地的 app 目錄掛載到容器的 /app 目錄 - ./log:/var/log # environment: # - REDIS_URL=redis://host.docker.internal:6579/0 # - CELERY_BROKER_URL=redis://host.docker.internal:6379/0 # - OMS_REDIS_URL=redis://host.docker.internal:6379/1 # - SERVER_URL=https://odoo-oms.dbee.hk services: celery_ui: <<: *app working_dir: /app/oms-odoo/backend/src command: python -m celery -A main_task.app flower --port=8002 ports: - "8803:8002" depends_on: - celery_worker env_file: - ./backend/docker.env celery_beat: <<: *app working_dir: /app/oms-odoo/backend/src command: python -m celery -A main_task.app beat --loglevel=info --logfile=/var/log/celery_beat.log depends_on: - celery_worker env_file: - ./backend/docker.env celery_worker: <<: *app working_dir: /app/oms-odoo/backend/src command: python -m celery -A main_task.app worker --loglevel=info --logfile=/var/log/celery_worker.log depends_on: - db - redis env_file: - ./backend/docker.env deploy: resources: limits: cpus: '1.0' memory: 2048M app: <<: *app working_dir: /app/oms-odoo/backend/src command: python -m uvicorn main:app --reload --port 8022 --host 0.0.0.0 ports: - "8022:8022" # network_mode: "host" env_file: - ./backend/docker.env environment: - SERVER_URL=http://localhost:8069 depends_on: - db - redis deploy: resources: limits: cpus: '1.0' memory: 2048M healthcheck: # 健康檢查 test: [ "CMD", "curl", "--fail", "http://localhost:8022/" ] interval: 30s timeout: 10s retries: 5 start_period: 30s db: image: postgres:16 environment: POSTGRES_DB: oms_database POSTGRES_USER: username POSTGRES_PASSWORD: password ports: - "5632:5432" # 如果需要訪問 PostgreSQL 的埠 # volumes: # - postgres_data:/var/lib/postgresql/data redis: image: redis:latest ports: - "6579:6379" # 如果需要訪問 Redis 的埠 #volumes: # postgres_data: