Optimization :

* using alpine linux as base
* xwiki version as building arguments instead of hardcoded
* add libreoffice and its xwiki configuration to import Office documents
* set environment.permanentDirectory

Fix:
* SMTP environment variables set as empty string
This commit is contained in:
fecaille
2016-04-05 13:32:18 +02:00
parent 69488bb4c4
commit ea63c5f7e6
2 changed files with 43 additions and 16 deletions

View File

@@ -1,20 +1,38 @@
FROM jetty:9.3.7-jre8
FROM frolvlad/alpine-oraclejdk8
ARG XWIKI_VERSION=8.0
ARG JETTY_MAJOR=stable-9
ARG JETTY_VERSION=9.3.8.v20160314
ENV JETTY_BASE /usr/local/jetty
ENV MYSQL_USER xwiki
ENV MYSQL_PASSWORD dbpass
ENV MYSQL_HOST db
ENV WIKI_CONTEXT xwiki
ENV ADMIN_EMAIL xwiki@host.com
ENV SMTP_HOST mail.host.com
ENV SMTP_PROTOCOL tls
ENV SMTP_LOGIN xwiki
ENV SMTP_PASSWORD xwiki
ENV ADMIN_EMAIL ''
ENV SMTP_HOST ''
ENV SMTP_PROTOCOL ''
ENV SMTP_LOGIN ''
ENV SMTP_PASSWORD ''
RUN curl http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-8.0-milestone-2.war --output ${JETTY_BASE}/xwiki8.war
RUN curl http://download.forge.ow2.org/xwiki/xwiki-enterprise-ui-mainwiki-all-8.0-milestone-2.xar --output ${JETTY_BASE}/xwiki8.xar
RUN mkdir -p ${JETTY_BASE}/webapps/ROOT/
RUN unzip ${JETTY_BASE}/xwiki8.war -d ${JETTY_BASE}/webapps/ROOT/
RUN curl http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar --output ${JETTY_BASE}/webapps/ROOT/WEB-INF/lib/mysql-connector-java-5.jar
RUN apk update && \
apk add --no-cache libreoffice curl && \
cd /usr/local && \
curl -sSL "http://eclipse.org/downloads/download.php?file=/jetty/${JETTY_MAJOR}/dist/jetty-distribution-${JETTY_VERSION}.tar.gz&r=1" -o jetty.tar.gz && \
tar -xzf jetty.tar.gz && \
ln -s jetty-distribution-${JETTY_VERSION} jetty && \
rm jetty.tar.gz
RUN curl -sL http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-${XWIKI_VERSION}.war --output ${JETTY_BASE}/xwiki${XWIKI_VERSION}.war && \
curl -sL http://download.forge.ow2.org/xwiki/xwiki-enterprise-ui-mainwiki-all-${XWIKI_VERSION}.xar --output ${JETTY_BASE}/xwiki${XWIKI_VERSION}.xar && \
mkdir -p ${JETTY_BASE}/webapps/ROOT/ && \
unzip -q ${JETTY_BASE}/xwiki${XWIKI_VERSION}.war -d ${JETTY_BASE}/webapps/ROOT/ && \
rm ${JETTY_BASE}/xwiki${XWIKI_VERSION}.war && \
curl -sL http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar --output ${JETTY_BASE}/webapps/ROOT/WEB-INF/lib/mysql-connector-java-5.jar
RUN rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /usr/share/doc/*
ADD ./start.sh /usr/local/bin/start.sh
ADD ./config/hibernate.cfg.xml ${JETTY_BASE}/webapps/ROOT/WEB-INF/

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
if [ "$WIKI_CONTEXT" != "" ];then
if [ ! -f "${JETTY_BASE}/webapps/${WIKI_CONTEXT}" ];then
@@ -27,8 +27,17 @@ if [ "$WIKI_CONTEXT" != "" ];then
else
sed -i "s|.*mail\.sender\.port = .*|mail.sender.port = 25|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
fi
set XWIKI_OPTS=%XWIKI_OPTS% -Doffice.path=/usr/lib/libreoffice/
sed -i "s|.*openoffice.serverType=0|openoffice.serverType=0|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
sed -i "s|.*openoffice.autoStart=false|openoffice.autoStart=true|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
sed -i "s|.*openoffice.homePath=/opt/openoffice.org3/|openoffice.homePath=/usr/lib/libreoffice/|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
sed -i "s|.*openoffice.taskExecutionTimeout=30000|openoffice.taskExecutionTimeout=120000|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
sed -i "s|.*environment.permanentDirectory=/var/local/xwiki/|environment.permanentDirectory=/var/local/xwiki/|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
fi
fi
java -jar "$JETTY_HOME/start.jar"
cd ${JETTY_BASE}
java -jar start.jar