Spotter-VM/sigmah/Dockerfile

49 lines
1.9 KiB
Docker

FROM alpine:3.7
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
# Cleanup
&& apk del paxctl
RUN \
# Install Tomcat 8
wget http://mirror.dkm.cz/apache/tomcat/tomcat-8/v8.0.49/bin/apache-tomcat-8.0.49.tar.gz -O /tmp/apache-tomcat-8.tgz \
&& tar xf /tmp/apache-tomcat-8.tgz -C /srv \
&& mv /srv/apache-tomcat-8.0.49 /srv/tomcat \
# Make catalina.sh available globally
&& ln -s /srv/tomcat/bin/catalina.sh /usr/bin/catalina.sh \
# Cleanup
&& rm -rf /srv/tomcat/webapps/ROOT /srv/tomcat/webapps/docs /srv/tomcat/webapps/examples /srv/tomcat/webapps/host-manager /srv/tomcat/webapps/manager \
&& rm -f /tmp/apache-tomcat-8.tgz
RUN \
# Download Sigmah
wget https://github.com/sigmah-dev/sigmah/releases/download/v2.0.2/sigmah-2.0.2.war -O /tmp/sigmah.war \
&& mkdir /srv/tomcat/webapps/sigmah \
&& unzip /tmp/sigmah.war -d /srv/tomcat/webapps/sigmah \
# Update Postgres JDBC driver
&& rm /srv/tomcat/webapps/sigmah/WEB-INF/lib/postgresql-9.1-901-1.jdbc4.jar \
&& wget https://jdbc.postgresql.org/download/postgresql-42.2.0.jar -O /srv/tomcat/webapps/sigmah/WEB-INF/lib/postgresql-42.2.0.jar \
# Remove logging config
&& rm /srv/tomcat/webapps/sigmah/WEB-INF/classes/logback.xml \
# Configure Tomcat port
&& sed -i 's/port="8080"/port="8015"/g' /srv/tomcat/conf/server.xml \
# Create OS user
&& addgroup -S -g 8015 sigmah \
&& adduser -S -u 8015 -h /srv/tomcat -s /bin/false -g sigmah -G sigmah sigmah \
&& chown -R sigmah:sigmah /srv/tomcat/conf /srv/tomcat/logs /srv/tomcat/temp /srv/tomcat/webapps /srv/tomcat/work \
# Cleanup
&& rm /tmp/sigmah.war
VOLUME ["/srv/sigmah/data"]
EXPOSE 8015
USER sigmah
WORKDIR /srv/tomcat
CMD ["catalina.sh", "run"]