diff --git a/docker-compose.yml b/docker-compose.yml index 78061d9a79..a3a1ce0157 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,36 +1,36 @@ --- + +x-common-settings: + &common-settings + image: freqtrade_with_numba + build: + context: . + dockerfile: "./docker/Dockerfile.custom" + restart: unless-stopped + volumes: + - "./user_data:/freqtrade/user_data" + - "./user_data/data:/freqtrade/user_data/data" + - "./configs:/freqtrade/configs" + - "./${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5}.py:/freqtrade/${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5}.py" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${FREQTRADE__API_SERVER__LISTEN_PORT:-8080}"] + interval: 1m30s + timeout: 10s + retries: 3 + start_period: 40s + start_interval: 5s + env_file: + - path: .env + required: false # default true + services: freqtrade: - # image: freqtradeorg/freqtrade:stable - image: freqtrade_with_numba - build: - context: . - dockerfile: "./docker/Dockerfile.custom" - restart: unless-stopped + <<: *common-settings container_name: ${FREQTRADE__BOT_NAME:-Example_Test_Account}_${FREQTRADE__EXCHANGE__NAME:-binance}_${FREQTRADE__TRADING_MODE:-futures}-${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5} - volumes: - - "./user_data:/freqtrade/user_data" - - "./user_data/data:/freqtrade/user_data/data" - - "./configs:/freqtrade/configs" - - "./${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5}.py:/freqtrade/${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5}.py" ports: - "${FREQTRADE__API_SERVER__LISTEN_PORT:-8080}:${FREQTRADE__API_SERVER__LISTEN_PORT:-8080}" # Default command used when running `docker compose up` - env_file: - - path: .env - required: false # default true command: > trade --db-url sqlite:////freqtrade/user_data/${FREQTRADE__BOT_NAME:-Example_Test_Account}_${FREQTRADE__EXCHANGE__NAME:-binance}_${FREQTRADE__TRADING_MODE:-futures}-tradesv3.sqlite --log-file user_data/logs/${FREQTRADE__BOT_NAME:-Example_Test_Account}-${FREQTRADE__EXCHANGE__NAME:-binance}-${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5}-${FREQTRADE__TRADING_MODE:-futures}.log - - restarter: - image: docker:cli - volumes: ["/var/run/docker.sock:/var/run/docker.sock"] - command: - [ - "/bin/sh", - "-c", - "while true; do sleep 86400; docker restart ${FREQTRADE__BOT_NAME:-Example_Test_Account}_${FREQTRADE__EXCHANGE__NAME:-binance}_${FREQTRADE__TRADING_MODE:-futures}-${FREQTRADE__STRATEGY:-NostalgiaForInfinityX5}; done", - ] - restart: unless-stopped