You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2019/11/01 16:28:12 UTC

[jspwiki] 02/03: Bringing in Docker support to ASF repo from https://github.com/metskem/docker-jspwiki. https://jspwiki-wiki.apache.org/Wiki.jsp?page=Docker needs to be updated, though

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 7c1e97a2b871ec08d819106cef2d1553fff1b687
Author: juanpablo <ju...@apache.org>
AuthorDate: Fri Nov 1 17:26:40 2019 +0100

    Bringing in Docker support to ASF repo from https://github.com/metskem/docker-jspwiki. https://jspwiki-wiki.apache.org/Wiki.jsp?page=Docker needs to be updated, though
---
 Dockerfile                    | 84 +++++++++++++++++++++++++++++++++++++++++++
 docker-files/log4j.properties | 24 +++++++++++++
 docker-files/tomcat-users.xml | 10 ++++++
 3 files changed, 118 insertions(+)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ef6d7db
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,84 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+FROM maven:3.6.2-jdk-8-alpine as package
+
+WORKDIR /opt
+
+COPY . .
+
+RUN set -x \
+# fastest, minimum build
+  && mvn clean package -pl jspwiki-war,jspwiki-wikipages/en -am -DskipTests
+
+FROM tomcat:8.5
+
+COPY --from=package /opt/jspwiki-war/target/JSPWiki.war /tmp
+COPY --from=package /opt/jspwiki-wikipages/en/target/jspwiki-wikipages-en-*.zip /tmp
+COPY docker-files/log4j.properties /tmp
+COPY docker-files/tomcat-users.xml $CATALINA_HOME/conf/tomcat-users.xml
+
+#
+# set default environment entries to configure jspwiki
+ENV CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom
+ENV LANG en_US.UTF-8
+ENV jspwiki_basicAttachmentProvider_storageDir /var/jspwiki/pages
+ENV jspwiki_fileSystemProvider_pageDir /var/jspwiki/pages
+ENV jspwiki_jspwiki_frontPage Main
+ENV jspwiki_pageProvider VersioningFileProvider
+ENV jspwiki_use_external_logconfig true
+ENV jspwiki_workDir /var/jspwiki/work
+ENV jspwiki_xmlUserDatabaseFile /var/jspwiki/etc/userdatabase.xml
+ENV jspwiki_xmlGroupDatabaseFile /var/jspwiki/etc/groupdatabase.xml
+
+RUN set -x \
+ && export DEBIAN_FRONTEND=noninteractive \
+ && apt install --fix-missing --quiet --yes unzip
+
+#
+# install jspwiki
+RUN set -x \
+ && mkdir /var/jspwiki \
+# remove default tomcat applications, we dont need them to run jspwiki
+ && cd $CATALINA_HOME/webapps \
+ && rm -rf examples host-manager manager docs ROOT \
+# remove other stuff we don't need
+ && rm -rf /usr/local/tomcat/bin/*.bat \
+# create subdirectories where all jspwiki stuff will live
+ && cd /var/jspwiki \
+ && mkdir pages logs etc work \
+# deploy jspwiki
+ && mkdir $CATALINA_HOME/webapps/ROOT \
+ && unzip -q -d $CATALINA_HOME/webapps/ROOT /tmp/JSPWiki.war \
+ && rm /tmp/JSPWiki.war \
+# deploy wiki pages
+ && cd /tmp/ \
+ && unzip -q jspwiki-wikipages-en-*.zip \
+ && mv jspwiki-wikipages-en-*/* /var/jspwiki/pages/ \
+ && rm -rf jspwiki-wikipages-en-* \
+# move the userdatabase.xml and groupdatabase.xml to /var/jspwiki/etc
+ && cd $CATALINA_HOME/webapps/ROOT/WEB-INF \
+ && mv userdatabase.xml groupdatabase.xml /var/jspwiki/etc \
+# arrange proper logging (jspwiki.use.external.logconfig = true needs to be set)
+ && mv /tmp/log4j.properties $CATALINA_HOME/lib/log4j.properties
+
+# make port visible in metadata
+EXPOSE 8080
+
+#
+# by default we start the Tomcat container when the docker container is started.
+CMD ["/usr/local/tomcat/bin/catalina.sh","run", ">/usr/local/tomcat/logs/catalina.out"]
\ No newline at end of file
diff --git a/docker-files/log4j.properties b/docker-files/log4j.properties
new file mode 100644
index 0000000..340bd3e
--- /dev/null
+++ b/docker-files/log4j.properties
@@ -0,0 +1,24 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+log4j.rootLogger=info,FileLog
+log4j.appender.FileLog = org.apache.log4j.RollingFileAppender
+log4j.appender.FileLog.MaxFileSize = 10MB
+log4j.appender.FileLog.MaxBackupIndex = 14
+log4j.appender.FileLog.File = /var/jspwiki/logs/jspwiki.log
+log4j.appender.FileLog.layout = org.apache.log4j.PatternLayout
+log4j.appender.FileLog.layout.ConversionPattern = %d [%t] %p %c %x - %m%n
diff --git a/docker-files/tomcat-users.xml b/docker-files/tomcat-users.xml
new file mode 100644
index 0000000..3491fb8
--- /dev/null
+++ b/docker-files/tomcat-users.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tomcat-users>
+  <role rolename="manager-gui"/>
+  <role rolename="manager-script"/>
+  <role rolename="manager-jmx"/>
+  <role rolename="manager-status"/>
+  <role rolename="admin"/>
+
+  <user username="admin" password="admin" roles="manager,manager-gui,manager-script,manager-jmx,manager-status"/>
+</tomcat-users>
\ No newline at end of file