From e6697d15105641e209fbd62684626d09e3c0ef20 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Thu, 2 Jan 2025 16:09:39 +0800 Subject: [PATCH] add workflows: sync mysql images -> images.onwalk.net --- .github/workflows/sync-images-mysql.yaml | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/sync-images-mysql.yaml diff --git a/.github/workflows/sync-images-mysql.yaml b/.github/workflows/sync-images-mysql.yaml new file mode 100644 index 0000000..fff05bf --- /dev/null +++ b/.github/workflows/sync-images-mysql.yaml @@ -0,0 +1,42 @@ +name: sync images for Mysql + +on: + schedule: + - cron: "0 0 * * *" + pull_request: + paths: + - '.github/workflows/sync-images-mysql.yaml' + workflow_dispatch: + branches: + - main + +jobs: + sync-images: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Initialization environment + env: + USER: ${{ secrets.IMAGES_REPO_USER }} + PASSWORD: ${{ secrets.IMAGES_REPO_PASSWORD }} + shell: bash + run: | + sudo apt update + sudo apt install git -y + echo "$PASSWORD" | docker login --username=$USER --password-stdin images.onwalk.net + + - name: sync images + shell: bash + run: | + function sync_image() + { + local src_image=$1 + local dest_image=$2 + docker pull $src_image + docker tag $src_image $dest_image + docker push $dest_image + } + sync_image "busybox:1.32" "images.onwalk.net/public/busybox:1.32" + sync_image "docker.io/mysql:5.7.30" "images.onwalk.net/public/database/mysql:5.7.30"