diff --git a/xwiki-mysql-tomcat/Dockerfile b/xwiki-mysql-tomcat/Dockerfile index 67b2a8a4c16a9232dbfcbdb42ab7e0c0d49c36f8..3ba9ac4baa7e2b956fd1b6c7100ac6078cea02c0 100644 --- a/xwiki-mysql-tomcat/Dockerfile +++ b/xwiki-mysql-tomcat/Dockerfile @@ -17,23 +17,18 @@ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA, or see the FSF site: http://www.fsf.org. # --------------------------------------------------------------------------- -FROM debian:jessie +FROM tomcat:8-jre8 MAINTAINER Vincent Massol <vincent@massol.net> # Note: when using docker-compose, the ENV values below are overridden from the .env file. -# Install Java8 + Tomcat + LibreOffice + other tools -RUN echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list && \ - apt-get update && \ +# Install LibreOffice + other tools +RUN apt-get update && \ apt-get -y upgrade && \ apt-get --no-install-recommends -y --force-yes install \ curl \ libreoffice \ - nano \ - openjdk-8-jdk \ - sudo \ - tomcat8 \ unzip && \ rm -rf /var/lib/apt/lists/* @@ -41,12 +36,11 @@ RUN echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/so # Create the Tomcat temporary directory # Configure the XWiki permanent directory ENV XWIKI_VERSION=8.4.4 -RUN rm -rf /var/lib/tomcat8/webapps/* && \ - mkdir -p /var/lib/tomcat8/temp && \ - mkdir -p /var/lib/xwiki/data && \ +RUN rm -rf /usr/local/tomcat/webapps/* && \ + mkdir -p /usr/local/tomcat/temp && \ + mkdir -p /usr/local/xwiki/data && \ curl -L "http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-${XWIKI_VERSION}.war" -o xwiki.war && \ - unzip -d /var/lib/tomcat8/webapps/ROOT xwiki.war && \ - chown -R tomcat8:tomcat8 /var/lib/tomcat8 /var/lib/xwiki/data && \ + unzip -d /usr/local/tomcat/webapps/ROOT xwiki.war && \ rm -f xwiki.war # Download the MySQL JDBC driver and install it in the XWiki webapp @@ -55,20 +49,20 @@ RUN curl -L https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java -o mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz && \ tar xvf mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz \ mysql-connector-java-${MYSQL_DRIVER_VERSION}/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar -O > \ - /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar && \ + /usr/local/tomcat/webapps/ROOT/WEB-INF/lib/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar && \ rm -f mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz # Configure Tomcat. For example set the memory for the Tomcat JVM since the default value is too small for XWiki -COPY tomcat/setenv.sh /usr/share/tomcat8/bin/ +COPY tomcat/setenv.sh /usr/local/tomcat/bin/ # Setup the XWiki Hibernate configuration ENV MYSQL_DATABASE=xwiki -COPY xwiki/hibernate.cfg.xml /var/lib/tomcat8/webapps/ROOT/WEB-INF/hibernate.cfg.xml +COPY xwiki/hibernate.cfg.xml /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml # Set a specific distribution id in XWiki for this docker packaging. RUN sed "s/<id>org.xwiki.enterprise:xwiki-enterprise-web/<id>org.xwiki.enterprise:xwiki-enterprise-docker/" \ - < /var/lib/tomcat8/webapps/ROOT/META-INF/extension.xed > /var/lib/tomcat8/webapps/ROOT/META-INF/extension2.xed && \ - mv /var/lib/tomcat8/webapps/ROOT/META-INF/extension2.xed /var/lib/tomcat8/webapps/ROOT/META-INF/extension.xed + < /usr/local/tomcat/webapps/ROOT/META-INF/extension.xed > /usr/local/tomcat/webapps/ROOT/META-INF/extension2.xed && \ + mv /usr/local/tomcat/webapps/ROOT/META-INF/extension2.xed /usr/local/tomcat/webapps/ROOT/META-INF/extension.xed # Add scripts required to make changes to XWiki configuration files at execution time COPY xwiki/xwiki-config-replace.sh /usr/local/bin/xwiki-config-replace.sh @@ -100,7 +94,7 @@ EXPOSE 8080 # are also passed to start_xwiki.sh. However at the moment start_xwiki.sh doesn't support any parameters and all # configurations are done through environment variable overrides (see above). ENV MYSQL_USER=xwiki \ - MYSQL_PASSWORD=xwiki \ + MYSQL_PASSWORD=xwiki ENTRYPOINT ["start_xwiki.sh"] # When no options are passed on the "docker run" command line we display a message explaining what environment diff --git a/xwiki-mysql-tomcat/tomcat/setenv.sh b/xwiki-mysql-tomcat/tomcat/setenv.sh index 5dccebf5b88e4ea00ebbd2552bd5bd4e5b412b0f..9e4977b6d51331fb964052c6db2503bebd01a5ba 100755 --- a/xwiki-mysql-tomcat/tomcat/setenv.sh +++ b/xwiki-mysql-tomcat/tomcat/setenv.sh @@ -1,3 +1 @@ -export CATALINA_HOME=/usr/share/tomcat8 -export CATALINA_BASE=/var/lib/tomcat8 export CATALINA_OPTS="-Xmx1024m" diff --git a/xwiki-mysql-tomcat/xwiki/start_xwiki.sh b/xwiki-mysql-tomcat/xwiki/start_xwiki.sh index a5a9175925b0c216551244d76a625aa74b0730fd..f4aa9bac95a25cb7d13c4d1f16c301f035eeeb4c 100755 --- a/xwiki-mysql-tomcat/xwiki/start_xwiki.sh +++ b/xwiki-mysql-tomcat/xwiki/start_xwiki.sh @@ -2,13 +2,13 @@ function first_start() { configure - sudo -u tomcat8 touch /var/lib/tomcat8/.first_start_completed + touch /usr/local/xwiki/.first_start_completed } function configure() { echo 'Configuring XWiki...' - sudo -u tomcat8 sed -i "s/replacemysqluser/${MYSQL_USERNAME:-xwiki}/g" /var/lib/tomcat8/webapps/ROOT/WEB-INF/hibernate.cfg.xml - sudo -u tomcat8 sed -i "s/replacemysqlpassword/${MYSQL_PASSWORD:-xwiki}/g" /var/lib/tomcat8/webapps/ROOT/WEB-INF/hibernate.cfg.xml + sed -i "s/replacemysqluser/${MYSQL_USERNAME:-xwiki}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml + sed -i "s/replacemysqlpassword/${MYSQL_PASSWORD:-xwiki}/g" /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml echo ' Using filesystem-based attachments...' xwiki-set-cfg 'xwiki.store.attachment.hint' 'file' @@ -19,13 +19,13 @@ function configure() { xwiki-set-cfg 'xwiki.authentication.encryptionKey' "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" echo ' Setting permanent directory...' - xwiki-set-properties 'environment.permanentDirectory' '/var/lib/xwiki/data' + xwiki-set-properties 'environment.permanentDirectory' '/usr/local/xwiki/data' echo ' Configure libreoffice...' xwiki-set-properties 'openoffice.autoStart' 'true' } -if [[ ! -f /var/lib/tomcat/.first_start_completed ]]; then +if [[ ! -f /usr/local/xwiki/.first_start_completed ]]; then first_start fi -sudo -u tomcat8 /usr/share/tomcat8/bin/catalina.sh run \ No newline at end of file +/usr/local/tomcat/bin/catalina.sh run \ No newline at end of file diff --git a/xwiki-mysql-tomcat/xwiki/xwiki-set-cfg b/xwiki-mysql-tomcat/xwiki/xwiki-set-cfg index fb816bc4c5c3e1c045610cec2ccffb8bbba78cd5..29c7411f97f80ca78e6cba1e95e9acc5046218d2 100755 --- a/xwiki-mysql-tomcat/xwiki/xwiki-set-cfg +++ b/xwiki-mysql-tomcat/xwiki/xwiki-set-cfg @@ -3,4 +3,4 @@ # $1 - the setting/property to set # $2 - the new value -sudo -u tomcat8 xwiki-config-replace.sh /var/lib/tomcat8/webapps/ROOT/WEB-INF/xwiki.cfg "$1" "$2" \ No newline at end of file +xwiki-config-replace.sh /usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.cfg "$1" "$2" \ No newline at end of file diff --git a/xwiki-mysql-tomcat/xwiki/xwiki-set-properties b/xwiki-mysql-tomcat/xwiki/xwiki-set-properties index 9ed9b49ff418d99743f1cfa1ca61513fbb7051df..90fb72d10bb79d04f564e73f5f7f11edd20ded02 100755 --- a/xwiki-mysql-tomcat/xwiki/xwiki-set-properties +++ b/xwiki-mysql-tomcat/xwiki/xwiki-set-properties @@ -3,4 +3,4 @@ # $1 - the setting/property to set # $2 - the new value -sudo -u tomcat8 xwiki-config-replace.sh /var/lib/tomcat8/webapps/ROOT/WEB-INF/xwiki.properties "$1" "$2" \ No newline at end of file +xwiki-config-replace.sh /usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties "$1" "$2" \ No newline at end of file