Docker image update

This commit is contained in:
YuruC3 2025-06-30 15:52:44 +02:00
parent f572e9f10e
commit 75cb35b954
4 changed files with 62 additions and 24 deletions

BIN
docker.tar.gz Normal file

Binary file not shown.

View File

@ -1,8 +1,11 @@
# python # python
20 */4 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainOPNsense.py
25 */4 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py
# 20 19 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainOPNsense.py
# 25 19 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py # 25 19 * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py
#*/3 * * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py #*/3 * * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainDocker.py
#*/3 * * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainOPNsense.py #*/3 * * * * /etc/debmirror/venv/bin/python3 /etc/debmirror/mainOPNsense.py
# git push # git push
# 30 19 * * * /bin/sh /etc/debmirror/gitPush.sh 30 */4 * * * /bin/sh /etc/debmirror/gitPush.sh
#*/1 * * * * /bin/sh /etc/debmirror/gitPush.sh #*/1 * * * * /bin/sh /etc/debmirror/gitPush.sh

View File

@ -3,14 +3,14 @@
services: services:
debmirup: debmirup:
container_name: Debian_Mirrors_Updater container_name: Debian_Mirrors_Updater
build: ./ # build: ./
image: debmirrorupd:V2.0.1 image: yuruc3/debianrepolist:v0.3
environment: environment:
- DEBMIRRORURL=https://www.debian.org/mirror/list - DEBMIRRORURL=https://www.debian.org/mirror/list
- GITURLPROTO=https - GITURLPROTO=https
- GITURL=tea.shupogaki.org - GITURL=tea.shupogaki.org
- GITREPOPATH=YuruC3/Debain-repos.git - GITREPOPATH=YuruC3/Repo-IP-lists.git
- GITEA_TOKEN=<CHANGHE_ME> - GITEA_TOKEN=0938a2033324b987bbcb2976b56d147a9a00d8a2
- EXTRAREPOS=True - EXTRAREPOS=True
- SECURITYREPOS=True - SECURITYREPOS=True
restart: unless-stopped restart: unless-stopped

View File

@ -5,39 +5,74 @@ WORKPTH="/etc/debmirror/"
REPO_DIR="$WORKPTH/Repo-IP-lists" REPO_DIR="$WORKPTH/Repo-IP-lists"
REPO_URL="${GITURLPROTO}://${GITURL}/${GITREPOPATH}" REPO_URL="${GITURLPROTO}://${GITURL}/${GITREPOPATH}"
# Clone repo if not exists
# Clone repo only if it doesn't already exist
if [ ! -d "$REPO_DIR/.git" ]; then if [ ! -d "$REPO_DIR/.git" ]; then
echo "[$(date)] Cloning repository..." echo "[$(date)] Cloning repository..."
git clone "$REPO_URL" "$REPO_DIR" git clone "$REPO_URL" "$REPO_DIR"
fi fi
cd "$REPO_DIR" cd "$REPO_DIR"
git remote set-url origin "https://${GITEA_TOKEN}@${GITURL}/${GITREPOPATH}" git remote set-url origin "https://${GITEA_TOKEN}@${GITURL}/${GITREPOPATH}"
git config user.name "UpdateBot" git config user.name "UpdateBot"
git config user.email "UpdateBot@localhost.local" git config user.email "UpdateBot@localhost.local"
# stage files # Stage the files
git add MirrorListV4 MirrorListV6 OPNS_MirrorListV4 OPNS_MirrorListV6 git add MirrorListV4 MirrorListV6 OPNS_MirrorListV4 OPNS_MirrorListV6
# If anything to commit locally, commit it now # Only proceed if there are staged changes
if ! git diff --quiet --cached; then if ! git diff --quiet --cached; then
echo "[$(date)] Committing local changes before pulling" echo "[$(date)] Committing and pushing changes..."
git commit -m "Auto-commit before pull on $(date -Iseconds)" git commit -m "Auto-update mirror list on $(date -Iseconds)"
fi git pull --rebase --autostash
# Now pull the latest
git pull --rebase --autostash
# Commit and push only if there's anything new staged
if git diff --quiet; then
echo "[$(date)] No changes to commit."
else
git commit -a -m "Auto-update mirror list on $(date -Iseconds)" --quiet
git push --quiet git push --quiet
echo "[$(date)] Changes pushed successfully." echo "[$(date)] Changes pushed."
else
echo "[$(date)] No changes to commit or push."
fi fi
# #!/bin/sh
# set -e
# WORKPTH="/etc/debmirror/"
# REPO_DIRd="$WORKPTH/Repo-IP-lists"
# REPO_URL="${GITURLPROTO}://${GITURL}/${GITREPOPATH}"
# # Clone repo only if it doesn't already exist
# if [ ! -d "$REPO_DIR/.git" ]; then
# echo "[$(date)] Cloning repository..."
# git clone "$REPO_URL" "$REPO_DIR"
# fi
# cd "$REPO_DIR"
# git remote set-url origin "https://${GITEA_TOKEN}@${GITURL}/${GITREPOPATH}"
# git config user.name "UpdateBot"
# git config user.email "UpdateBot@localhost.local"
# # stage files
# git add MirrorListV4 MirrorListV6 OPNS_MirrorListV4 OPNS_MirrorListV6
# # If anything to commit locally, commit it now
# if ! git diff --quiet --cached; then
# echo "[$(date)] Committing local changes before pulling"
# git commit -m "Auto-commit before pull on $(date -Iseconds)"
# fi
# # Now pull the latest
# git pull --rebase --autostash
# # Commit and push only if there's anything new staged
# if git diff --quiet; then
# echo "[$(date)] No changes to commit."
# else
# git commit -a -m "Auto-update mirror list on $(date -Iseconds)" --quiet
# git push --quiet
# echo "[$(date)] Changes pushed successfully."
# fi