本篇内容主要讲解“怎么在sun jdk 8镜像基础上构建tomcat 8 docker镜像 ”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么在sun jdk 8镜像基础上构建tomcat 8 docker镜像 ”吧!
FROM myimage/alpine_glibc_jdk:8 MAINTAINER tongqiang<tongqiangyin@gmail.com> ENV TOMCAT_MAJOR 8 ENV TOMCAT_VERSION 8.5.23 ENV CATALINA_HOME /usr/local/tomcat ENV PATH $CATALINA_HOME/bin:$PATH ENV TOMCAT_NATIVE_LIBDIR $CATALINA_HOME/native-jni-lib ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOMCAT_NATIVE_LIBDIR ENV TOMCAT_TGZ_URL http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-${TOMCAT_MAJOR}/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz RUN apk add --no-cache --virtual .build-deps \ ca-certificates \ tar \ wget \ openssl \ openssl-dev \ apr-dev \ coreutils \ dpkg-dev dpkg \ gcc \ libc-dev \ make \ && mkdir -p ${CATALINA_HOME} \ && wget -O tomcat.tar.gz ${TOMCAT_TGZ_URL} \ && tar -xvf tomcat.tar.gz -C ${CATALINA_HOME} --strip-components=1 \ && nativeBuildDir=$(mktemp -d) \ && tar -xvf ${CATALINA_HOME}/bin/tomcat-native.tar.gz -C ${nativeBuildDir} --strip-components=1 \ && ( cd ${nativeBuildDir}/native \ && gnuArch=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) \ && ./configure \ --build=${gnuArch} \ --libdir=${TOMCAT_NATIVE_LIBDIR} \ --prefix=${CATALINA_HOME} \ --with-apr=$(which apr-1-config) \ --with-java-home=${JAVA_HOME} \ --with-ssl=yes \ && make -j $(nproc) \ && make install) \ && runDeps=$( \ scanelf --needed --nobanner --recursive ${TOMCAT_NATIVE_LIBDIR} \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ | xargs -r apk info --installed \ | sort -u \ ) \ && apk add --virtual .tomcat-native-rundeps ${runDeps} \ && nativeLines=$(catalina.sh configtest 2>&1) \ && nativeLines=$(echo ${nativeLines} | grep 'Apache Tomcat Native') \ && nativeLines=$(echo ${nativeLines} | sort -u) \ && if ! echo ${nativeLines} | grep 'INFO: Loaded APR based Apache Tomcat Native library' >&2; then \ echo >&2 ${nativeLines}; \ exit 1; \ fi \ && apk del .build-deps \ && rm -rf ${CATALINA_HOME}/bin/*.bat \ ${CATALINA_HOME}/bin/tomcat-native.tar.gz \ ${CATALINA_HOME}/webapps/* \ tomcat.tar.gz EXPOSE 8080 CMD ["catalina.sh", "run"]
构建命令如下:
docker build -t alpine-sunjdk8-tomcat:8 .
到此,相信大家对“怎么在sun jdk 8镜像基础上构建tomcat 8 docker镜像 ”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。