-
Notifications
You must be signed in to change notification settings - Fork 521
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
add Dockerfile.build-and-run to realize multi-stage build;fix @testin… #813
base: master
Are you sure you want to change the base?
Conversation
…g-library/[email protected] has unmet peer dependency @testing-library/dom@>=5
这个是计划给不懂代码的用户用的吗? |
并没那么复杂的意图,只是项目之前那个Dockerfile只支持基于已经编译好的二进制程序进行构建,而我commit的这份Dockerfile.build-and-run支持完全通过源码(无论arm还是x86)进行docker镜像构建,包括了前端打包以及golang二进制编译的部分,无论对开发者还是普通用户都是巨大的便利性 |
这个项目最初也是用的本地编译binary包进本地docker image,但从某个时期开始,原作者修改了docker包含可执行文件的方式到了现在这样。我猜这是为了更好地统计用户数量(github release有下载计数)。 我们等一下 @hr3lxphr6j 的意见吧 |
当初把编译扔到docker build外的主要目标是减少CI的执行时间,避免超时。如果放在docker build里,go mod download、node modules下载和node build的时间就是O(n)的(arch数),也没法利用go build产生的cache,导致执行时间会非常长,我记得会到小时级别。 所以我想法是:
PR方面的话有几个问题哈:
|
这个观点 @hr3lxphr6j 怎么看? |
emmm,对于大部分不懂代码的人,安装docker和搞一个能运行 |
抱歉,是我的失误,我已经revert并删除了test.sh;我并不熟悉makefile,能力范围内仅能提供dockerfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Dockerfile.build-and-run
Outdated
|
||
COPY . . | ||
|
||
#配置国内源并进行构建 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这会不会对不在国内的开发者有点不方便。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不知道 docker 构建时能否从外部设置代理,或者默认在OS的代理设置下访问网络。
比起硬编码代理到dockerfile里,让用户在外部翻墙也许通用性更好一些。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者留一个可以从构建时的命令行获取代理信息的变量?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不知道 docker 构建时能否从外部设置代理,或者默认在OS的代理设置下访问网络。
比起硬编码代理到dockerfile里,让用户在外部翻墙也许通用性更好一些。
我先移除了设置golang国内源这行吧,确实有些多余,感觉国内的开发者但凡用到docker,应该都具备科学上网的能力
我可能周末有时间的时候会在本地测试一下这个dockerfile,没问题就merge了。 @hr3lxphr6j 如果有空测试的话,你直接merge就可以。 |
…g-library/[email protected] has unmet peer dependency @testing-library/dom@>=5
搞一个多阶段构建的dockerfile,包含了node和golang的依赖,自动构建最小化镜像,这样用户可以不用自己搭建环境,并用上最新的代码;经过测试在开启科学上网的情况下,构建成功率百分之百