Skip to content

Update docker.yaml

Update docker.yaml #6

Workflow file for this run

name: Docker
on:
workflow_dispatch:
push:
branches: [ sealos ]
env:
ALIYUN_REGISTRY: "${{ secrets.ALIYUN_REGISTRY }}"
ALIYUN_NAME_SPACE: "${{ secrets.ALIYUN_NAME_SPACE }}"
ALIYUN_REGISTRY_USER: "${{ secrets.ALIYUN_REGISTRY_USER }}"
ALIYUN_REGISTRY_PASSWORD: "${{ secrets.ALIYUN_REGISTRY_PASSWORD }}"
jobs:
build:
name: Pull
runs-on: ubuntu-latest
steps:
- name: Setup sealos
run: |
set -e
curl -LO https://github.com/labring/sealos/releases/download/v4.3.3/sealos_4.3.3_linux_amd64.tar.gz
tar -xzvf sealos_4.3.3_linux_amd64.tar.gz
chmod +x sealos
echo "$PWD/sealos" >> $GITHUB_PATH
cat $GITHUB_PATH
- name: Check out code
uses: actions/checkout@v2
- name: Build and push image Aliyun
run: |
set -e
sealos login -u $ALIYUN_REGISTRY_USER -p $ALIYUN_REGISTRY_PASSWORD $ALIYUN_REGISTRY
while IFS= read -r line; do
[[ -z "$line" ]] && continue
echo "sealos pull $line"
sealos pull $line
# 获取镜像的完整名称,例如kasmweb/nginx:1.25.3(命名空间/镜像名:版本号)
image=$(echo "$line" | awk '{print $NF}')
# 获取 镜像名:版本号 例如nginx:1.25.3
image_name_tag=$(echo "$image" | awk -F'/' '{print $NF}')
new_image="$ALIYUN_REGISTRY/$ALIYUN_NAME_SPACE/$image_name_tag"
echo "sealos tag $image $new_image"
sealos tag $image $new_image
echo "sealos push $new_image"
sealos push $new_image
done < images.txt