dockerfile基于apline将JDK20打包成镜像
今天就来和大家聊聊如何把最新出版的JDK20打包成docker镜像,很多uu都会采用centos作为基础镜像,这么做会有一个问题,centos系统会含有很多库文件,这些库文件JDK程序并不是完全需要的,运行在服务器上会占用很多资源,这就没有必要。我们可以采用apline作为基础镜像打包,apline只包含一些基础命令,是linux系列中最干净的版本啦。文章来源:https://www.toymoban.com/news/detail-689143.html
下面就是基于alpine打包JDK20的镜像啦,至于JDK的安装包需要大家去网络上下载啦,或者关注我的微信公众号【智享学习】回复【JDK20】获取网盘链接。文章来源地址https://www.toymoban.com/news/detail-689143.html
FROM alpine:3.15
ARG version=20.0.2.9.1
# Please note that the THIRD-PARTY-LICENSE could be out of date if the base image has been updated recently.
# The Corretto team will update this file but you may see a few days' delay.
RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz && \
echo "82f3e50e71b2aee21321b2b33de372feed5befad6ef2196ddec92311bc09becb /THIRD-PARTY-LICENSES-20200824.tar.gz" | sha256sum -c - && \
tar x -ovzf THIRD-PARTY-LICENSES-20200824.tar.gz && \
rm -rf THIRD-PARTY-LICENSES-20200824.tar.gz && \
wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub && \
SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" && \
echo "${SHA_SUM} /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - && \
echo "https://apk.corretto.aws" >> /etc/apk/repositories && \
apk add --no-cache amazon-corretto-20=$version-r0 && \
rm -rf /usr/lib/jvm/java-20-amazon-corretto/lib/src.zip
ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/default-jvm
ENV PATH=$PATH:/usr/lib/jvm/default-jvm/bin
到了这里,关于dockerfile基于apline将JDK20打包成镜像的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!