twbworld / twbworld.GitHub.io

忐忑の博客
https://twbhub.com
MIT License
1 stars 0 forks source link

使用Github Actions发布docker镜像到仓库 | 忐忑の博客 #28

Open twbworld opened 3 years ago

twbworld commented 3 years ago

https://twbhub.com/post/github-actions_publish_images/

使用GitHub Actions实现对docker包的自动化构建及发布

twbworld commented 3 years ago

我是作者

horaoen commented 2 years ago

你是我的救星

lanyucomputer commented 2 years ago

name: ci on: workflow_dispatch: #github页面手动触发 push: tags:

lanyucomputer commented 2 years ago

0s Run docker/login-action@v1 Logging into ghcr.io... Login Succeeded! 0s Run docker/build-push-action@v2 Docker info /usr/bin/docker buildx build --file ./Dockerfile --iidfile /tmp/docker-build-push-5JnPya/iidfile --tag ghcr.io/lanyucomputer/openwrt_s912_zyxq_R22.4.1_k5.15.34-flippy-71+o.img.gz: --tag ghcr.io/lanyucomputer/openwrt_s912_zyxq_R22.4.1_k5.15.34-flippy-71+o.img.gz:latest --metadata-file /tmp/docker-build-push-5JnPya/metadata-file --push . error: invalid tag "ghcr.io/lanyucomputer/openwrt_s912_zyxq_R22.4.1_k5.15.34-flippy-71+o.img.gz:": invalid reference format Error: buildx failed with: error: invalid tag "ghcr.io/lanyucomputer/openwrt_s912_zyxq_R22.4.1_k5.15.34-flippy-71+o.img.gz:": invalid reference format

lanyucomputer commented 2 years ago

Run docker/build-push-action@v2 Docker info /usr/bin/docker buildx build --file ./Dockerfile --iidfile /tmp/docker-build-push-t5PG5d/iidfile --tag ghcr.io/lanyucomputer/OpenWrt2022: --tag ghcr.io/lanyucomputer/OpenWrt2022:latest --metadata-file /tmp/docker-build-push-t5PG5d/metadata-file --push . error: invalid tag "ghcr.io/lanyucomputer/OpenWrt2022:": invalid reference format Error: buildx failed with: error: invalid tag "ghcr.io/lanyucomputer/OpenWrt2022:": invalid reference format

lanyucomputer commented 2 years ago

换成库的名字也是这个提示,说TAG的格式不对,但脚 本是完全复制上面的

twbworld commented 2 years ago

换成库的名字也是这个提示,说TAG的格式不对,但脚 本是完全复制上面的

我猜测应该是ghcr.io不支持您所使用的名称,您试下在git使用简单点的名称打tag, 如"V1.0.1"

lanyucomputer commented 2 years ago

感谢你的回复,我的地址库改成OpenWrt2022 也是一样的提示,原码地址https://github.com/lanyucomputer/OpenWrt2022在这里,可以帮忙看一下吗,还是报错,docker-compose.yml 是这个文件

lanyucomputer commented 2 years ago

@twbworld

换成库的名字也是这个提示,说TAG的格式不对,但脚 本是完全复制上面的

我猜测应该是ghcr.io不支持您所使用的名称,您试下在git使用简单点的名称打tag, 如"V1.0.1"

感谢你的回复,我的地址库改成OpenWrt2022 也是一样的提示,原码地址https://github.com/lanyucomputer/OpenWrt2022在这里,可以帮忙看一下吗,还是报错,docker-compose.yml 是这个文件

twbworld commented 2 years ago
on:
  workflow_dispatch:
  push:
    tags:
      - "v*.*"

跟你的地址库没关, 要使用git打上一个tag,名称的格式为"v.",如"v1.0.1",它才会打包

或者把"${{ needs.get-tags.outputs.tags }}"写死,改为你自定义的名称

lanyucomputer commented 2 years ago

写死为:lastest后报错如下 error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount187581008/Dockerfile: no such file or directory Error: buildx failed with: error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount187581008/Dockerfile: no such file or directory