FastApi-GeminiApi/docker-compose.yml
2025-11-30 18:36:07 +03:30

59 lines
1.7 KiB
YAML

version: "3.8"
services:
# -------------------------
# XRAY / V2RAY PROXY
# -------------------------
xray:
image: ghcr.io/xtls/xray-core:latest
container_name: xray
volumes:
# Your JSON config with "listen": "0.0.0.0" on the inbound
- ./xray-config.json:/etc/xray/config.json:ro
# ENTRYPOINT of image is already "xray"
# So this becomes: xray run -c /etc/xray/config.json
command: ["run", "-c", "/etc/xray/config.json"]
ports:
- "10808:10808" # optional: expose to host for debugging
restart: unless-stopped
# -------------------------
# AIFIT FASTAPI SERVICE
# -------------------------
aifit-fastapi:
build:
context: .
dockerfile: Dockerfile
container_name: aifit-fastapi
ports:
- "8000:8000"
# For local dev hot-reload; remove in production if you want
volumes:
- .:/app
env_file:
- .env # should contain GEMINI_API_KEY, AIFIT_AUTH_KEY, AIFIT_PROXY_URL (optional)
environment:
PYTHONPATH: /app
FFMPEG_BIN: /usr/bin/ffmpeg
FFPROBE_BIN: /usr/bin/ffprobe
# Explicitly pass sensitive vars from .env (so they are available even if env_file is ignored)
GEMINI_API_KEY: ${GEMINI_API_KEY}
AIFIT_AUTH_KEY: ${AIFIT_AUTH_KEY}
# Proxy URL for Gemini client.
# In .env you can set: AIFIT_PROXY_URL=socks5://xray:10808
# The default here is also socks5://xray:10808 if env is missing.
AIFIT_PROXY_URL: ${AIFIT_PROXY_URL:-socks5://xray:10808}
depends_on:
- xray
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s