-
Notifications
You must be signed in to change notification settings - Fork 142
67 lines (60 loc) · 2.16 KB
/
docker-pull.yml
File metadata and controls
67 lines (60 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: 拉取镜像推送
on:
workflow_dispatch:
inputs:
IMAGE_NAME:
description: '原镜像名称:版本'
required: true
default: 'mysql/mysql-server'
NEW_NAME:
description: '同步后镜像名称:版本'
required: true
default: 'mysql-server'
TARGET_REGISTRY:
description: '仓库地址'
required: true
default: 'registry.cn-chengdu.aliyuncs.com'
TARGET_REPOSITORY:
description: '空间名称'
required: true
default: 'aopkcn'
ARCH:
description: '系统架构'
required: true
default: 'amd64'
type: choice
options:
- amd64
- arm64
- arm/v7
- arm/v6
- 386
- s390x
- ppc64le
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 登录到 Docker 仓库
id: login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} ${{ github.event.inputs.TARGET_REGISTRY }}
continue-on-error: true
- name: 检查 Docker 登录成功
if: ${{ steps.login.outcome == 'success' }}
run: echo "Docker 登录成功"
- name: 检查 Docker 登录失败
if: ${{ steps.login.outcome != 'success' }}
run: echo "Docker 登录失败"
- name: 拉取、标记并推送 Docker 镜像
id: pull_tag_push
run: |
docker pull --platform ${{ github.event.inputs.ARCH }} ${{ github.event.inputs.IMAGE_NAME }}
docker tag ${{ github.event.inputs.IMAGE_NAME }} ${{ github.event.inputs.TARGET_REGISTRY }}/${{ github.event.inputs.TARGET_REPOSITORY }}/${{ github.event.inputs.NEW_NAME }}
docker push ${{ github.event.inputs.TARGET_REGISTRY }}/${{ github.event.inputs.TARGET_REPOSITORY }}/${{ github.event.inputs.NEW_NAME }}
continue-on-error: true
- name: 检查镜像推送成功
if: ${{ steps.pull_tag_push.outcome == 'success' }}
run: echo "Docker 镜像推送成功"
- name: 检查镜像推送失败
if: ${{ steps.pull_tag_push.outcome != 'success' }}
run: echo "Docker 镜像推送失败"