forked from tech-shrimp/docker_image_pusher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6abdf67
Showing
7 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Docker | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
|
||
|
||
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 Docker buildx | ||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push image Aliyun | ||
run: | | ||
docker login -u $ALIYUN_REGISTRY_USER -p $ALIYUN_REGISTRY_PASSWORD $ALIYUN_REGISTRY | ||
for line in $(cat images.txt); do | ||
docker pull $line | ||
image_name_tag=$(echo $line | awk -F'/' '{print $NF}') | ||
new_image="$ALIYUN_REGISTRY/$ALIYUN_NAME_SPACE/$image_name_tag" | ||
echo "docker tag $image $new_image" | ||
docker tag $line $new_image | ||
echo "docker push $new_image" | ||
docker push $new_image | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Docker Images Pusher | ||
|
||
使用Github Action将Docker镜像上传到阿里云供国内服务器使用,免费易配置 | ||
|
||
作者:**技术爬爬虾**<br> | ||
B站,抖音,Youtube全网同名,转载请注明作者<br> | ||
|
||
## 使用方式 | ||
|
||
|
||
### 配置阿里云 | ||
登录阿里云容器镜像服务<br> | ||
https://cr.console.aliyun.com/<br> | ||
启用个人实例,创建一个命名空间(ALIYUN_NAME_SPACE) | ||
![](/doc/命名空间.png) | ||
进入访问凭证,获取用户名(ALIYUN_REGISTRY_USER),密码(ALIYUN_REGISTRY_PASSWORD),仓库地址(ALIYUN_REGISTRY) | ||
![](/doc/用户名密码.png) | ||
|
||
|
||
### Fork本项目 | ||
Fork本项目<br> | ||
进入您自己的项目,点击Action,启用Github Action功能 | ||
配置环境变量,进入Settings->Secret and variables->Actions->New Repository secret | ||
![](doc/配置环境变量.png) | ||
将上一步的 ALIYUN_NAME_SPACE,ALIYUN_REGISTRY_USER,ALIYUN_REGISTRY_PASSWORD,ALIYUN_REGISTRY | ||
配置成环境变量 | ||
|
||
### 添加镜像 | ||
打开images.txt文件,添加你想要的镜像,可以带tag号,也可以不用(默认latest) | ||
文件提交后自动进入Github Action构建 | ||
|
||
### 使用镜像 | ||
回到阿里云,镜像仓库,点击任意镜像,有镜像使用的命令行提示。 | ||
![](doc/开始使用.png) | ||
|
||
如何pull镜像:<br> | ||
registry.cn-hangzhou.aliyuncs.com 即变量 ALIYUN_REGISTRY<br> | ||
shrimp-images 即变量 ALIYUN_NAME_SPACE<br> | ||
alpine 即images.txt里面填的镜像名称<br> | ||
``` | ||
docker pull registry.cn-hangzhou.aliyuncs.com/shrimp-images/alpine | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alpine | ||
kasmweb/nginx:1.25.3 |