docker update

This commit is contained in:
Michael S2pac 2025-11-27 13:47:41 +03:00
parent 67d4142c3a
commit c4c5aee9ac
3 changed files with 20 additions and 16 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
# shared volume
geodata/
# Ignore editor and IDE settings
.idea/
.vscode/

View file

@ -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/

View file

@ -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
;;
*)