您的位置:首页 > 财经 > 金融 > JDK的Dockerfile

JDK的Dockerfile

2024/12/23 8:35:22 来源:https://blog.csdn.net/hhhjjjj/article/details/139243230  浏览:    关键词:JDK的Dockerfile

openjdk(https://openjdk.org/)

也可以用微软的 https://learn.microsoft.com/zh-cn/java/openjdk/download#openjdk-17

使用debian系统

FROM openjdk:17-slim
MAINTAINER xxxENV SCM_PARAMS=""
ENV JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=dev -Djava.security.egd=file:/dev/./urandom"ENV TZ PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtimeRUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get cleanRUN apt-get update \&& apt-get install -y locales apt-utils \&& apt-get install -y --no-install-recommends vim \&& apt-get install -y --no-install-recommends curlADD ./target/report-basic-*.jar /app.jarEXPOSE 8080ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $SCM_PARAMS"]

azul(https://www.azul.com/downloads/?version=java-17-lts&package=jdk#zulu)

ubuntu

FROM azul/zulu-openjdk:17
MAINTAINER e-zhangjiawei01ENV SCM_PARAMS=""
ENV JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=dev -Djava.security.egd=file:/dev/./urandom"ENV TZ PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone#https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11iKr4j6
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
#RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get clean
#
RUN apt-get update \&& apt-get install -y locales apt-utils \&& apt-get install -y --no-install-recommends vim \&& apt-get install -y --no-install-recommends curlADD ./target/location-*.jar /app.jarEXPOSE 8080
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $SCM_PARAMS"]

debian:

FROM azul/zulu-openjdk-debian:17
MAINTAINER xxxxENV SCM_PARAMS=""
ENV JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=dev -Djava.security.egd=file:/dev/./urandom"ENV TZ PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtimeRUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get cleanRUN apt-get update \&& apt-get install -y locales apt-utils \&& apt-get install -y --no-install-recommends vim \&& apt-get install -y --no-install-recommends curlADD ./target/report-basic-*.jar /app.jarEXPOSE 8080ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $SCM_PARAMS"]

aws-corretto(https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html)

不建议
aws-linux 和centos类似的系统

FROM amazoncorretto:17
MAINTAINER xxxxENV SCM_PARAMS=""
ENV JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime# 移除已有的yum仓库文件#RUN rm -f /etc/yum.repos.d/*
# 添加阿里云的yum仓库文件
#ADD ./Centos-7.repo /etc/yum.repos.d/
# 清理缓存并生成新的缓存
RUN yum clean all && yum makecacheRUN yum install -y vim \yum install -y curlADD ./target/report-basic-*.jar /app.jarENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $SCM_PARAMS"]

sapmachine(https://sap.github.io/SapMachine/)

FROM sapmachine:17-jdk-ubuntu-nobleENV SCM_PARAMS=""
ENV JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=dev"ENV TZ PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezoneRUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list.d/ubuntu.sources
RUN sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list.d/ubuntu.sources
RUN apt-get cleanRUN apt-get update \&& apt-get install -y locales apt-utils \&& apt-get install -y --no-install-recommends vim \&& apt-get install -y --no-install-recommends curlADD ./target/location-*.jar /app.jarEXPOSE 8080ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $SCM_PARAMS"]

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com