Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: wenfei6316 <[email protected]>
  • Loading branch information
wenfei6316 committed Jul 7, 2024
1 parent 49367e0 commit 73c4780
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 13 deletions.
55 changes: 43 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ https://cr.console.aliyun.com/<br>
启用个人实例,创建一个命名空间(**ALIYUN_NAME_SPACE**
![](/doc/命名空间.png)

访问凭证–>获取环境变量<br>
访问凭证->设置固定密码<br />

访问凭证–>获取环境变量:<br>
用户名(**ALIYUN_REGISTRY_USER**)<br>
密码(**ALIYUN_REGISTRY_PASSWORD**)<br>
仓库地址(**ALIYUN_REGISTRY**)<br>
Expand All @@ -28,14 +30,25 @@ https://cr.console.aliyun.com/<br>


### Fork本项目
Fork本项目<br>
Fork github项目到自己账号下:https://github.com/wenfei6316/docker_image_pusher<br>
#### 启动Action
进入您自己的项目,点击Action,启用Github Action功能<br>

![image-20240707080918296](/doc/action.png)

#### 配置环境变量
进入Settings->Secret and variables->Actions->New Repository secret
![](doc/配置环境变量.png)
![](/doc/配置环境变量.png)
将上一步的**四个值**<br>
ALIYUN_NAME_SPACE,ALIYUN_REGISTRY_USER,ALIYUN_REGISTRY_PASSWORD,ALIYUN_REGISTRY<br>
ALIYUN_NAME_SPACE, ALIYUN_REGISTRY_USER, ALIYUN_REGISTRY_PASSWORD, ALIYUN_REGISTRY<br>

```
ALIYUN_NAME_SPACE: wenfei6316 # 上面命名空间的名称
ALIYUN_REGISTRY_USER: wenfei6316 # 阿里云的账号名
ALIYUN_REGISTRY_PASSWORD: xxxxxxx # 设置固定密码时的密码
ALIYUN_REGISTRY: registry.cn-hangzhou.aliyuncs.com # 访问凭据->登录实例下面有
```

配置成环境变量

### 添加镜像
Expand All @@ -44,37 +57,55 @@ ALIYUN_NAME_SPACE,ALIYUN_REGISTRY_USER,ALIYUN_REGISTRY_PASSWORD,ALIYUN_REGIS
可添加 --platform=xxxxx 的参数指定镜像架构<br>
可使用 k8s.gcr.io/kube-state-metrics/kube-state-metrics 格式指定私库<br>
可使用 #开头作为注释<br>
![](doc/images.png)
![](/doc/images.png)
文件提交后,自动进入Github Action构建

内容模板

```
# 模板一
xhofe/alist:latest
# 模板二
--platform=linux/arm64 xiaoyaliu/alist
# 模板三
opengrok/docker
```

### 使用镜像
回到阿里云,镜像仓库,点击任意镜像,可查看镜像状态。(可以改成公开,拉取镜像免登录)
![](doc/开始使用.png)
![](/doc/开始使用.png)

在国内服务器pull镜像, 例如:<br>
```
docker pull registry.cn-hangzhou.aliyuncs.com/shrimp-images/alpine
# 国内镜像登录
sudo docker login --username=wenfei6316 registry.cn-hangzhou.aliyuncs.com
# 国内镜像拉取
docker pull registry.cn-hangzhou.aliyuncs.com/wenfei6316/nginx
```
registry.cn-hangzhou.aliyuncs.com 即 ALIYUN_REGISTRY(阿里云仓库地址)<br>
shrimp-images 即 ALIYUN_NAME_SPACE(阿里云命名空间)<br>
alpine 即 阿里云中显示的镜像名<br>
wenfei6316 即 ALIYUN_NAME_SPACE(阿里云命名空间)<br>
nginx 即 阿里云中显示的镜像名<br>

### 多架构
需要在images.txt中用 --platform=xxxxx手动指定镜像架构
指定后的架构会以前缀的形式放在镜像名字前面
![](doc/多架构.png)
![](/doc/多架构.png)

### 镜像重名
程序自动判断是否存在名称相同, 但是属于不同命名空间的情况。
如果存在,会把命名空间作为前缀加在镜像名称前。
例如:

```
xhofe/alist
xiaoyaliu/alist
```
![](doc/镜像重名.png)
![](/doc/镜像重名.png)

### 定时执行
修改/.github/workflows/docker.yaml文件
添加 schedule即可定时执行(此处cron使用UTC时区)
![](doc/定时执行.png)
![](/doc/定时执行.png)
Binary file added doc/action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/命名空间.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/用户名密码.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion images.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#支持私库
jimmylang74/opengrok-22.04:latest
opengrok/docker
#支持指定架构
--platform=linux/arm64 xiaoyaliu/alist

0 comments on commit 73c4780

Please sign in to comment.