分发(构建)Go 应用镜像正确的方式是什么
Solution A
[Building Docker Containers for Go Applications]1.
[The Go Dockerfile - Build With Dep, Ship From Scratch]2.
维护容器化构建 Dockerfile,分发代码仓库和容器编排文件,到生产环境以后重新构建?
(或者 CI/CD?这种就比较近似于方案 B 了。)
Solution B
使用 Gox 开发环境交叉编译,然后直接丢容器里,容器上传仓库进行分发。
References
- https://www.callicoder.com/docker-golang-image-container-example/.
- https://pierreprinetti.com/blog/2018-the-go-dockerfile/.
- https://github.com/mitchellh/gox.git.