Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

镜像自动构建 #36

Open
zjjxwhh opened this issue Jul 1, 2024 · 2 comments
Open

镜像自动构建 #36

zjjxwhh opened this issue Jul 1, 2024 · 2 comments

Comments

@zjjxwhh
Copy link

zjjxwhh commented Jul 1, 2024

是否可以通过 GitHub Action 的方式自动构建 docker 镜像并且发布到 Docker Hub 或者 ghcr,这样既方便普通用户私有部署,也可以通过 watchtower 等工具自动更新镜像,而不需要用户在仓库更新之后手动拉取代码、本地构建镜像。

感谢大佬辛勤开发,希望项目越来越好!

@joye61
Copy link
Owner

joye61 commented Jul 15, 2024

我没有研究过Github Action,并且我对Docker也是一知半解,现在没有时间去研究实现你提的需求,你是否可以帮忙实现?

@zjjxwhh
Copy link
Author

zjjxwhh commented Jul 15, 2024

同样不太熟,不过面向 ChatGPT 编程解决了,代码可以直接用 build.yml,放在 .github/workflows 这个路径下即可,我 fork 您的代码测试了可以成功构建,此外还需要您作为仓库 Owner 做一些操作:

  1. Docker Hub 上注册账号
  2. 在本仓库的 Sittings - Secrets and variables - Actions 下创建两个 Repository secrets,Name 为 DOCKER_USERNAMEDOCKER_PASSWORD,Secret 分别为 Docker Hub 的账号和密码,构建生成的镜像会被自动推送到 Docker Hub 的 {$DOCKER_USERNAME}/pic-smaller 仓库

image

  1. 触发构建方式有两种,可以手动触发(这一次就需要您手动触发一下),仓库的 master 分支有 push 操作时也会自动触发构建

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants