docker-atlassian-confluence.../Dockerfile
2016-09-09 04:58:42 +00:00

74 lines
4.1 KiB
Docker

FROM java:openjdk-8-jre
MAINTAINER Atlassian Confluence
# Setup useful environment variables
ENV CONFLUENCE_HOME /var/atlassian/application-data/confluence
ENV CONFLUENCE_INSTALL /opt/atlassian/confluence
ENV CONF_VERSION 5.10.5
LABEL Description="This image is used to start Atlassian Confluence" Vendor="Atlassian" Version="${CONF_VERSION}"
ENV CONFLUENCE_DOWNLOAD_URL http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-${CONF_VERSION}.tar.gz
ENV MYSQL_VERSION 5.1.38
ENV MYSQL_DRIVER_DOWNLOAD_URL http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_VERSION}.tar.gz
# Use the default unprivileged account. This could be considered bad practice
# on systems where multiple processes end up being executed by 'daemon' but
# here we only ever run one process anyway.
ENV RUN_USER daemon
ENV RUN_GROUP daemon
# Install Atlassian Confluence and helper tools and setup initial home
# directory structure.
RUN set -x \
&& apt-get update --quiet \
&& apt-get install --quiet --yes --no-install-recommends libtcnative-1 xmlstarlet \
&& apt-get clean \
&& mkdir -p "${CONFLUENCE_HOME}" \
&& chmod -R 700 "${CONFLUENCE_HOME}" \
&& chown ${RUN_USER}:${RUN_GROUP} "${CONFLUENCE_HOME}" \
&& mkdir -p "${CONFLUENCE_INSTALL}/conf" \
&& curl -Ls "${CONFLUENCE_DOWNLOAD_URL}" | tar -xz --directory "${CONFLUENCE_INSTALL}" --strip-components=1 --no-same-owner \
&& curl -Ls "${MYSQL_DRIVER_DOWNLOAD_URL}" | tar -xz --directory "${CONFLUENCE_INSTALL}/confluence/WEB-INF/lib" --strip-components=1 --no-same-owner "mysql-connector-java-${MYSQL_VERSION}/mysql-connector-java-${MYSQL_VERSION}-bin.jar" \
&& chmod -R 700 "${CONFLUENCE_INSTALL}/conf" \
&& chmod -R 700 "${CONFLUENCE_INSTALL}/temp" \
&& chmod -R 700 "${CONFLUENCE_INSTALL}/logs" \
&& chmod -R 700 "${CONFLUENCE_INSTALL}/work" \
&& chown -R ${RUN_USER}:${RUN_GROUP} "${CONFLUENCE_INSTALL}/conf" \
&& chown -R ${RUN_USER}:${RUN_GROUP} "${CONFLUENCE_INSTALL}/temp" \
&& chown -R ${RUN_USER}:${RUN_GROUP} "${CONFLUENCE_INSTALL}/logs" \
&& chown -R ${RUN_USER}:${RUN_GROUP} "${CONFLUENCE_INSTALL}/work" \
&& echo -e "\nconfluence.home=${CONFLUENCE_HOME}" >> "${CONFLUENCE_INSTALL}/confluence/WEB-INF/classes/confluence-init.properties" \
&& xmlstarlet ed --inplace \
--delete "Server/@debug" \
--delete "Server/Service/Connector/@debug" \
--delete "Server/Service/Connector/@useURIValidationHack" \
--delete "Server/Service/Connector/@minProcessors" \
--delete "Server/Service/Connector/@maxProcessors" \
--delete "Server/Service/Engine/@debug" \
--delete "Server/Service/Engine/Host/@debug" \
--delete "Server/Service/Engine/Host/Context/@debug" \
"${CONFLUENCE_INSTALL}/conf/server.xml" \
&& touch -d "@0" "${CONFLUENCE_INSTALL}/conf/server.xml"
# Use the default unprivileged account. This could be considered bad practice
# on systems where multiple processes end up being executed by 'daemon' but
# here we only ever run one process anyway.
USER ${RUN_USER}:${RUN_GROUP}
# Expose default HTTP connector port.
EXPOSE 8090
# Set volume mount points for installation and home directory. Changes to the
# home directory needs to be persisted as well as parts of the installation
# directory due to eg. logs.
VOLUME ["${CONFLUENCE_INSTALL}", "${CONFLUENCE_HOME}"]
# Set the default working directory as the Confluence installation directory.
WORKDIR ${CONFLUENCE_INSTALL}
# Run Atlassian Confluence as a foreground process by default.
CMD ["./bin/catalina.sh", "run"]