From c4c5aee9acea0c7dec44c8653e5badd374de307a Mon Sep 17 00:00:00 2001 From: Michael S2pac Date: Thu, 27 Nov 2025 13:47:41 +0300 Subject: [PATCH] docker update --- .gitignore | 3 +++ docker-compose.yml | 5 +++-- docker-cron-runner/xray-tools.sh | 28 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 8fa4eeb0..69b9c69d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# shared volume +geodata/ + # Ignore editor and IDE settings .idea/ .vscode/ diff --git a/docker-compose.yml b/docker-compose.yml index a9d69373..2c70c4f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,11 +42,12 @@ services: depends_on: - docker-proxy environment: + ENABLE_CRON_UPDATE: "true" TZ: "UTC" DOCKER_PROXY_URL: "http://docker-proxy:2375" TARGET_CONTAINER_NAME: "3xui_app" -# CRON_SCHEDULE: "*/5 * * * *" - CRON_SCHEDULE: "0 */6 * * *" + CRON_SCHEDULE: "*/1 * * * *" +# CRON_SCHEDULE: "0 */6 * * *" SHARED_VOLUME_PATH: "/app/bin" volumes: - $PWD/geodata/:/app/bin/ diff --git a/docker-cron-runner/xray-tools.sh b/docker-cron-runner/xray-tools.sh index a2ddd682..caf1dc92 100644 --- a/docker-cron-runner/xray-tools.sh +++ b/docker-cron-runner/xray-tools.sh @@ -2,8 +2,8 @@ update_all_geofiles() { update_main_geofiles - update_ir_geofiles - update_ru_geofiles +# update_ir_geofiles +# update_ru_geofiles } update_main_geofiles() { @@ -22,16 +22,16 @@ update_ru_geofiles() { } update_geodata_in_docker() { - WORKDIR="$1" + XRAYDIR="$1" OLD_DIR=$(pwd) trap 'cd "$OLD_DIR"' EXIT echo "[$(date)] Running update_geodata" - if [ ! -d "$WORKDIR" ]; then - mkdir -p "$WORKDIR" + if [ ! -d "$XRAYDIR" ]; then + mkdir -p "$XRAYDIR" fi - cd "$WORKDIR" + cd "$XRAYDIR" update_all_geofiles echo "[$(date)] All geo files have been updated successfully!" @@ -40,7 +40,7 @@ update_geodata_in_docker() { install_xray_core() { TARGETARCH="$1" - WORKDIR="$2" + XRAYDIR="$2" XRAY_VERSION="$3" OLD_DIR=$(pwd) @@ -75,10 +75,10 @@ install_xray_core() { ;; esac - if [ ! -d "$WORKDIR" ]; then - mkdir -p "$WORKDIR" + if [ ! -d "$XRAYDIR" ]; then + mkdir -p "$XRAYDIR" fi - cd "$WORKDIR" + cd "$XRAYDIR" wget -q "https://github.com/XTLS/Xray-core/releases/download/${XRAY_VERSION}/Xray-linux-${ARCH}.zip" unzip "Xray-linux-${ARCH}.zip" -d ./xray-unzip @@ -95,17 +95,17 @@ if [ "${0##*/}" = "xray-tools.sh" ]; then case "$cmd" in install_xray_core) - # args: TARGETARCH WORKDIR XRAY_VERSION + # args: TARGETARCH XRAYDIR XRAY_VERSION install_xray_core "$@" ;; update_geodata_in_docker) - # args: WORKDIR + # args: XRAYDIR update_geodata_in_docker "$@" ;; ""|help|-h|--help) echo "Usage:" - echo " $0 install_xray_core TARGETARCH WORKDIR XRAY_VERSION" - echo " $0 update_geodata_in_docker WORKDIR" + echo " $0 install_xray_core TARGETARCH XRAYDIR XRAY_VERSION" + echo " $0 update_geodata_in_docker XRAYDIR" exit 1 ;; *)