Github Action 生成 Docker 失败。

130 天前
 Rebron1900

各位大佬们晚上好,因为在用的一个项目作者不接受 pr ,无奈只能自己修改,但是发现卡在发布 Docker 这一步,能帮我看看是怎么回事吗?

Action 日志地址: https://github.com/rebron1900/yarr/actions/runs/7364702258/job/20045334141

错误信息

/usr/bin/docker buildx build --iidfile /tmp/docker-build-push-Yx82f1/iidfile --platform linux/amd64,linux/arm64,linux/arm/v7 --tag ***/yarr:latest --tag ***/yarr:v2.5 --metadata-file /tmp/docker-build-push-Yx82f1/metadata-file --push .
#0 building with "builder-dd8b3058-a7fa-457b-a92a-cc56c9c1b5e0" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2B done
#1 DONE 0.0s
ERROR: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory
Error: buildx failed with: ERROR: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory
990 次点击
所在节点    GitHub
12 条回复
kassadin
130 天前
no such file or directory
Dockerfile 的路径
Rebron1900
130 天前
这个 action 我是从其他项目里复制出来的,不太懂他的运行逻辑
Mogeko
130 天前
docker/build-push-action@v2 加上

with:
file: etc/dockerfile
Georgehu
130 天前
Rebron1900
130 天前
@Georgehu 我试试,谢谢大佬。另外我好奇的是,整个 action 我复制自 https://github.com/arsfeld/yarr-build 这个项目,他里面就没有写./etc/dockerfile 这个设置,为啥他可以我不行...
mulu
130 天前
@Rebron1900 默认使用当前工作路径下的 dockerfile 文件,你 fork 的那个项目 master 分支的 dockerfile 文件放在 etc 文件夹下。
tag 的 dockerfile 文件放在根目录。
而你拷贝的那个 yarr-build 编译的不是 master 分支,是 tag 。
https://github.com/nkanaev/yarr/tree/v2.4
```
name: Checkout
uses: actions/checkout@v2
with:
repository: 'nkanaev/yarr'
ref: ${{ steps.read-tag.outputs.tag }}
```
Rebron1900
130 天前
@mulu 懂了,谢谢大佬指点。
Rebron1900
130 天前
@mulu 大佬我看了一下他的 tag ,好像确实和 master 分支有不一样的文件结构,他这个是怎么做到的呢?我对这方面完全没有经验,可以加个 wx 号咨询一下你吗?
arloor
130 天前
楼上大佬强
另外 op 可以看下 github action 的文档系统了解下,github action 这个工具挺可以的
mulu
129 天前
@Rebron1900 额,他这个仓库最新的发版 tag 是几个月前,然后他两个月前有个 commit 修改了 dockerfile 位置。看他 commit 历史记录就好。
https://github.com/nkanaev/yarr/commit/d787060a24ddb690d67405c7f08dba9a7c578fe1
Rebron1900
129 天前
@mulu 我这也太蠢了
Rebron1900
129 天前
@mulu 谢谢大佬,已经成功执行了。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1004725

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX