[sword-svn] r437 - trunk

scribe at crosswire.org scribe at crosswire.org
Sun Mar 5 18:21:51 MST 2017


Author: scribe
Date: 2017-03-05 18:21:50 -0700 (Sun, 05 Mar 2017)
New Revision: 437

Modified:
   trunk/Dockerfile
Log:
Updated with ghelling's patches to optimize build process and image size


Modified: trunk/Dockerfile
===================================================================
--- trunk/Dockerfile	2017-03-05 01:56:38 UTC (rev 436)
+++ trunk/Dockerfile	2017-03-06 01:21:50 UTC (rev 437)
@@ -1,10 +1,8 @@
 FROM fedora:25
 
 # add tomcat
-ENV CATALINA_HOME /usr/local/tomcat
+ENV CATALINA_HOME /usr/local/tomcat/
 ENV PATH $CATALINA_HOME/bin:$PATH
-RUN mkdir -p "$CATALINA_HOME"
-WORKDIR $CATALINA_HOME
 
 # let "Tomcat Native" live somewhere isolated
 ENV TOMCAT_NATIVE_LIBDIR $CATALINA_HOME/native-jni-lib
@@ -18,47 +16,51 @@
 # not all the mirrors actually carry the .asc files :'(
 ENV TOMCAT_ASC_URL https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz.asc
 
+# Upload files into the image
+ADD "$TOMCAT_TGZ_URL" "$TOMCAT_ASC_URL" "$CATALINA_HOME"
+COPY docker-template/java.security /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/
+COPY docker-template/swordorbserver /usr/bin/
+COPY docker-template/sword.conf /etc/
+COPY docker-template/sword-mods /usr/share/sword/
+
+WORKDIR $CATALINA_HOME
+
 RUN set -x \
 	\
 	&& dnf install -y \
-		wget \
 		java-1.8.0-openjdk-headless \
 		libicu \
 		clucene-core \
 		omniORB \
-	&& wget -O tomcat.tar.gz "$TOMCAT_TGZ_URL" \
-	&& wget -O tomcat.tar.gz.asc "$TOMCAT_ASC_URL" \
-	&& tar -xvf tomcat.tar.gz --strip-components=1 \
+	&& mv closer.cgi apache-tomcat-$TOMCAT_VERSION.tar.gz \
+	&& tar -xvf apache-tomcat-$TOMCAT_VERSION.tar.gz --strip-components=1 \
 	&& rm bin/*.bat \
-	&& rm tomcat.tar.gz* 
+	&& rm apache-tomcat-$TOMCAT_VERSION.tar.gz* \
+	&& rm -rf /usr/local/tomcat/webapps/ROOT/* \
+	&& dnf clean all \
+	&& { \
+		echo '#!/bin/bash'; \
+		echo '#if [[ -z $DEFAULTBIBLE || -z $LOGLEVEL ]]; then'; \
+		echo "#  echo 'Missing either DEFAULTBIBLE, or LOGLEVEL.'"; \
+		echo "#  echo 'example: docker run -e DEFAULTBIBLE=KJV -e LOGLEVEL=DEBUG crosswire/swordweb'"; \
+		echo '#  exit 1'; \
+		echo '#fi'; \
+		echo 'if [[ -z $LOGLEVEL ]]; then'; \
+		echo '  LOGLEVEL=INFO'; \
+		echo 'fi'; \
+		echo 'if [[ -z $DEFAULTBIBLE ]]; then'; \
+		echo '  DEFAULTBIBLE=KJV'; \
+		echo 'fi'; \
+		echo 'sed -i "s!\$DEFAULTBIBLE!$DEFAULTBIBLE!g" "/usr/local/tomcat/webapps/ROOT/WEB-INF/swordweb.properties"'; \
+		echo 'sed -i "s!\$LOGLEVEL!$LOGLEVEL!g" "/usr/local/tomcat/webapps/ROOT/WEB-INF/classes/log4j.properties"'; \
+		tail -n +2 /usr/local/tomcat/bin/catalina.sh; \
+	} > /usr/local/tomcat/bin/catalina.sh.new \
+	&& cat /usr/local/tomcat/bin/catalina.sh.new > /usr/local/tomcat/bin/catalina.sh
 
-RUN rm -rf /usr/local/tomcat/webapps/ROOT/*
 COPY webapp/ /usr/local/tomcat/webapps/ROOT/
 COPY docker-template/context.xml /usr/local/tomcat/webapps/ROOT/META-INF/
 COPY docker-template/log4j.properties /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/
 COPY docker-template/swordweb.properties /usr/local/tomcat/webapps/ROOT/WEB-INF/
-COPY docker-template/java.security /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/
-COPY docker-template/swordorbserver /usr/bin/
-COPY docker-template/sword.conf /etc/
-COPY docker-template/sword-mods /usr/share/sword/
-RUN { \
-	echo '#!/bin/bash'; \
-	echo '#if [[ -z $DEFAULTBIBLE || -z $LOGLEVEL ]]; then'; \
-	echo "#  echo 'Missing either DEFAULTBIBLE, or LOGLEVEL.'"; \
-	echo "#  echo 'example: docker run -e DEFAULTBIBLE=KJV -e LOGLEVEL=DEBUG crosswire/swordweb'"; \
-	echo '#  exit 1'; \
-	echo '#fi'; \
-	echo 'if [[ -z $LOGLEVEL ]]; then'; \
-	echo '  LOGLEVEL=INFO'; \
-	echo 'fi'; \
-	echo 'if [[ -z $DEFAULTBIBLE ]]; then'; \
-	echo '  DEFAULTBIBLE=KJV'; \
-	echo 'fi'; \
-	echo 'sed -i "s!\$DEFAULTBIBLE!$DEFAULTBIBLE!g" "/usr/local/tomcat/webapps/ROOT/WEB-INF/swordweb.properties"'; \
-	echo 'sed -i "s!\$LOGLEVEL!$LOGLEVEL!g" "/usr/local/tomcat/webapps/ROOT/WEB-INF/classes/log4j.properties"'; \
-	tail -n +2 /usr/local/tomcat/bin/catalina.sh; \
-	} > /usr/local/tomcat/bin/catalina.sh.new
-RUN cat /usr/local/tomcat/bin/catalina.sh.new > /usr/local/tomcat/bin/catalina.sh
 
 EXPOSE 8080 8009
 CMD ["catalina.sh", "run"]




More information about the sword-cvs mailing list