workflows: sync images nginx -> images.onwalk.net

This commit is contained in:
Haitao Pan 2024-11-26 11:46:52 +08:00
parent 259b1b8391
commit f93c6d9fc4

View File

@ -0,0 +1,45 @@
name: sync images for Nginx
on:
schedule:
- cron: "0 0 * * *"
pull_request:
paths:
- '.github/workflows/sync-images-nginx.yaml'
push:
paths:
- '.github/workflows/sync-images-nginx.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 "nginx:1.16.0" "images.onwalk.net/public/nginx:1.16.0"
sync_image "docker.io/nginx/nginx-ingress:2.4.0" "images.onwalk.net/public/nginx/nginx-ingress:2.4.0"