frontc / gitalk

1 stars 0 forks source link

为spring boot项目构建docker镜像 | LeFer #108

Open frontc opened 4 years ago

frontc commented 4 years ago

https://www.lefer.cn/posts/3002/

Spring Boot 2.3发布后带来了新特性之一就是对构建镜像的便捷支持,声称不用写dockerfile就能方便的构建docker image,最近刚好在写一个项目于是折腾了一下,只能说还不太适合国内用户,最终还是老老实实的写了dockerfile,下文记录折腾的过程。 按照官方文档的指引,Spring Boot V2.3.0 M默认就包含了自动构建相关的插件,只需要在项目根目录执行下面一行

wangenci commented 4 years ago

你我的距离只是隔了一堵墙

frontc commented 4 years ago

@wangenci 你我的距离只是隔了一堵墙

one world one net

weir2010 commented 4 years ago

同样问题

fangzhengjin commented 4 years ago

镜像倒是可以使用阿里云的:
registry.aliyuncs.com/paketo-buildpacks/image:tag
但是第二个镜像确实没找到更改方式

fangzhengjin commented 4 years ago

@frontc 原因找到了 gcr.io/paketo-buildpacks/run:base-cnb 这个镜像是配置在builder镜像中的, 除非spring boot改插件允许使用镜像替换, 否则官方直接支持是不太可能了~ 基于原始的builder镜像我把地址做了下修改, 调整成了阿里云镜像仓库的地址, 有需要的可以直接使用下方镜像构建

Docker Hub: fangzhengjin/paketo-buildpacks-builder:base-platform-api-0.3 Aliyun Mirror: registry.aliyuncs.com/fangzhengjin/paketo-buildpacks-builder:base-platform-api-0.3

w-a-n-g-s-h-u-n commented 4 years ago

2.4.0 可以指定runImage了

                        <builder>registry.cn-hangzhou.aliyuncs.com/paketo-buildpacks/builder:base-platform-api-0.3</builder>
                        <runImage>registry.cn-hangzhou.aliyuncs.com/paketo-buildpacks/run:base-cnb</runImage>
fangzhengjin commented 4 years ago

2.4.0 可以指定runImage了

                        <builder>registry.cn-hangzhou.aliyuncs.com/paketo-buildpacks/builder:base-platform-api-0.3</builder>
                        <runImage>registry.cn-hangzhou.aliyuncs.com/paketo-buildpacks/run:base-cnb</runImage>

2.4.0 GA还得等等

frontc commented 4 years ago

@fangzhengjin

2.4.0 可以指定runImage了

                        <builder>registry.cn-hangzhou.aliyuncs.com/paketo-buildpacks/builder:base-platform-api-0.3</builder>
                        <runImage>registry.cn-hangzhou.aliyuncs.com/paketo-buildpacks/run:base-cnb</runImage>

2.4.0 GA还得等等

总归算是好消息,值得期待

lzimd commented 4 years ago

2.3.x 可以用 paketobuildpacks/builder:base.

可参考 github.com/paketo-buildpacks/base-builder 的 issue.

bootBuildImage {
//    builder = "gcr.io/paketo-buildpacks/builder:base-platform-api-0.3"
    builder = "paketobuildpacks/builder:base"
}