From 2bf186ccd54a3d2f266a8cea6d02710d2b80c026 Mon Sep 17 00:00:00 2001 From: stam Date: Wed, 19 May 2021 18:49:57 +0300 Subject: [PATCH] confluence 6 templates --- .../data/confluence/templates/6/Dockerfile | 49 +++++++++++++++++++ .../data/confluence/templates/6/Makefile | 5 ++ .../confluence/templates/6/docker-compose.yml | 9 ++++ .../data/confluence/templates/6/entrypoint.sh | 39 +++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 bin/dotnet/data/confluence/templates/6/Dockerfile create mode 100644 bin/dotnet/data/confluence/templates/6/Makefile create mode 100644 bin/dotnet/data/confluence/templates/6/docker-compose.yml create mode 100644 bin/dotnet/data/confluence/templates/6/entrypoint.sh diff --git a/bin/dotnet/data/confluence/templates/6/Dockerfile b/bin/dotnet/data/confluence/templates/6/Dockerfile new file mode 100644 index 000000000..f3e6e40c1 --- /dev/null +++ b/bin/dotnet/data/confluence/templates/6/Dockerfile @@ -0,0 +1,49 @@ +FROM epicmorg/prod:jdk8 +LABEL maintainer="Atlassian Jira Server Team; EpicMorg DevTeam, developer@epicm.org" +ARG DEBIAN_FRONTEND=noninteractive + +################################################################## +# ARGuments +################################################################## + +#configured by dockerfile / .ENV +ARG RELEASE +ARG DOWNLOAD_URL + + +################################################################## +# Setup +################################################################## +ENV RUN_USER daemon +ENV RUN_GROUP daemon + +# https://confluence.atlassian.com/doc/confluence-home-and-other-important-directories-590259707.html +ENV CONFLUENCE_HOME /var/atlassian/application-data/confluence +ENV CONFLUENCE_INSTALL_DIR /opt/atlassian/confluence + +VOLUME ["${CONFLUENCE_HOME}"] +WORKDIR $CONFLUENCE_HOME + +# Expose HTTP and Synchrony ports +EXPOSE 8090 +EXPOSE 8091 + +################################################################## +# Installing +################################################################## +RUN mkdir -p ${CONFLUENCE_INSTALL_DIR} \ + && curl -L ${DOWNLOAD_URL} | tar -xz --strip-components=1 -C "$CONFLUENCE_INSTALL_DIR" \ + && chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_INSTALL_DIR}/ \ + && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} \${JVM_SUPPORT_RECOMMENDED_ARGS} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + && sed -i -e 's/port="8090"/port="8090" secure="${catalinaConnectorSecure}" scheme="${catalinaConnectorScheme}" proxyName="${catalinaConnectorProxyName}" proxyPort="${catalinaConnectorProxyPort}"/' ${CONFLUENCE_INSTALL_DIR}/conf/server.xml && \ + + update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \ + apt clean -y && \ + apt autoclean -y && \ + rm -rfv /var/lib/apt/lists/* && \ + rm -rfv /var/cache/apt/archives/*.deb + +CMD ["/entrypoint.sh", "-fg"] +ENTRYPOINT ["/usr/bin/tini", "--"] +COPY entrypoint.sh /entrypoint.sh +COPY . /tmp diff --git a/bin/dotnet/data/confluence/templates/6/Makefile b/bin/dotnet/data/confluence/templates/6/Makefile new file mode 100644 index 000000000..82c5a2de6 --- /dev/null +++ b/bin/dotnet/data/confluence/templates/6/Makefile @@ -0,0 +1,5 @@ +all: app + +app: + docker-compose build --compress + docker-compose push diff --git a/bin/dotnet/data/confluence/templates/6/docker-compose.yml b/bin/dotnet/data/confluence/templates/6/docker-compose.yml new file mode 100644 index 000000000..3e8eba866 --- /dev/null +++ b/bin/dotnet/data/confluence/templates/6/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.9' +services: + app: + image: "epicmorg/confluence:${RELEASE}" + build: + context: . + args: + RELEASE: ${RELEASE} + DOWNLOAD_URL: ${DOWNLOAD_URL} \ No newline at end of file diff --git a/bin/dotnet/data/confluence/templates/6/entrypoint.sh b/bin/dotnet/data/confluence/templates/6/entrypoint.sh new file mode 100644 index 000000000..250fc031a --- /dev/null +++ b/bin/dotnet/data/confluence/templates/6/entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -euo pipefail + +export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") +export JRE_HOME="$JAVA_HOME/jre" +export JAVA_BINARY="$JRE_HOME/bin/java" +export JAVA_VERSION=$("$JAVA_BINARY" -version 2>&1 | awk -F '"' '/version/ {print $2}') + + +# Setup Catalina Opts +: ${CATALINA_CONNECTOR_PROXYNAME:=} +: ${CATALINA_CONNECTOR_PROXYPORT:=} +: ${CATALINA_CONNECTOR_SCHEME:=http} +: ${CATALINA_CONNECTOR_SECURE:=false} + +: ${CATALINA_OPTS:=} + +CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorProxyName=${CATALINA_CONNECTOR_PROXYNAME}" +CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorProxyPort=${CATALINA_CONNECTOR_PROXYPORT}" +CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorScheme=${CATALINA_CONNECTOR_SCHEME}" +CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorSecure=${CATALINA_CONNECTOR_SECURE}" + +export CATALINA_OPTS + + +# Start Confluence as the correct user +if [ "${UID}" -eq 0 ]; then + echo "User is currently root. Will change directory ownership to ${RUN_USER}:${RUN_GROUP}, then downgrade permission to ${RUN_USER}" + PERMISSIONS_SIGNATURE=$(stat -c "%u:%U:%a" "${CONFLUENCE_HOME}") + EXPECTED_PERMISSIONS=$(id -u ${RUN_USER}):${RUN_USER}:700 + if [ "${PERMISSIONS_SIGNATURE}" != "${EXPECTED_PERMISSIONS}" ]; then + chmod -R 700 "${CONFLUENCE_HOME}" && + chown -R "${RUN_USER}:${RUN_GROUP}" "${CONFLUENCE_HOME}" + fi + # Now drop privileges + exec su -s /bin/bash "${RUN_USER}" -c "$CONFLUENCE_INSTALL_DIR/bin/start-confluence.sh $@" +else + exec "$CONFLUENCE_INSTALL_DIR/bin/start-confluence.sh" "$@" +fi