将脚本文件 build.sh
、jdk 压缩包 jdk-8u201-linux-x64.tar.gz
和 Dockerfile
放到同一个目录,然后执行脚本即可
Dockerfile
FROM frolvlad/alpine-glibc:alpine-3.8
ENV JAVA_HOME="/usr/lib/jvm/default-jvm" \
JRE_HOME="/usr/lib/jvm/default-jvm/jre" \
PATH="/usr/lib/jvm/default-jvm/bin:$PATH"
ADD jvm /usr/lib/jvm
RUN mkdir -p /data/apps && echo 'http://mirrors.aliyun.com/alpine/v3.8/main' > /etc/apk/repositories && echo 'http://mirrors.aliyun.com/alpine/v3.8/community' >>/etc/apk/repositories && apk update && apk --no-cache add -U tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && apk del tzdata
build.sh
WORK=`pwd`
IMAGE_URL=registry.hhotel.com/java/jdk8201
JAVA_VERSION=8
#yum install wget unzip -y && \
tar -xzf `ls *.tar.gz` && \
TMP=`ls -l |awk '/^d/ {print $NF}'` && \
wget --header "Cookie: oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jce/${JAVA_VERSION}/jce_policy-${JAVA_VERSION}.zip" && \
unzip -jo -d "$TMP/jre/lib/security" "jce_policy-${JAVA_VERSION}.zip" && rm -rf "jce_policy-${JAVA_VERSION}.zip" && \
rm -rf "$TMP/"*src.zip \
"$TMP/lib/missioncontrol" \
"$TMP/lib/visualvm" \
"$TMP/lib/"*javafx* \
"$TMP/jre/lib/plugin.jar" \
"$TMP/jre/lib/ext/jfxrt.jar" \
"$TMP/jre/bin/javaws" \
"$TMP/jre/lib/javaws.jar" \
"$TMP/jre/lib/desktop" \
"$TMP/jre/plugin" \
"$TMP/jre/lib/"deploy* \
"$TMP/jre/lib/"*javafx* \
"$TMP/jre/lib/"*jfx* \
"$TMP/jre/lib/amd64/libdecora_sse.so" \
"$TMP/jre/lib/amd64/"libprism_*.so \
"$TMP/jre/lib/amd64/libfxplugins.so" \
"$TMP/jre/lib/amd64/libglass.so" \
"$TMP/jre/lib/amd64/libgstreamer-lite.so" \
"$TMP/jre/lib/amd64/"libjavafx*.so \
"$TMP/jre/lib/amd64/"libjfx*.so \
"$TMP/jre/bin/jjs" \
"$TMP/jre/bin/keytool" \
"$TMP/jre/bin/orbd" \
"$TMP/jre/bin/pack200" \
"$TMP/jre/bin/policytool" \
"$TMP/jre/bin/rmid" \
"$TMP/jre/bin/rmiregistry" \
"$TMP/jre/bin/servertool" \
"$TMP/jre/bin/tnameserv" \
"$TMP/jre/bin/unpack200" \
"$TMP/jre/lib/ext/nashorn.jar" \
"$TMP/jre/lib/jfr.jar" \
"$TMP/jre/lib/jfr" \
"$TMP/jre/lib/oblique-fonts" \
"$TMP/jre/lib/security/README.txt" && \
ln -s $TMP default-jvm && \
mkdir jvm && mv $TMP default-jvm jvm && \
mkdir $WORK/build && \
cp $WORK/Dockerfile $WORK/build && \
mv jvm $WORK/build && \
cd $WORK/build && docker build --rm --no-cache -t $IMAGE_URL . && \
rm -rf $WORK/build
docker push $IMAGE_URL
docker rmi $IMAGE_URL
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于