FROM alpine:3.7 MAINTAINER Disassembler 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.48/bin/apache-tomcat-8.0.48.tar.gz -O /tmp/apache-tomcat-8.tgz \ && tar xf /tmp/apache-tomcat-8.tgz -C /srv \ && mv /srv/apache-tomcat-8.0.48 /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 Motech wget http://nexus.motechproject.org/service/local/repositories/releases/content/org/motechproject/motech-platform-server/1.0/motech-platform-server-1.0.war -O /tmp/motech.war \ && mkdir /srv/tomcat/webapps/motech \ && unzip /tmp/motech.war -d /srv/tomcat/webapps/motech \ # Update Postgres JDBC driver && rm -f /srv/tomcat/webapps/motech/WEB-INF/lib/postgresql-9.1-901.jdbc4.jar /srv/tomcat/webapps/motech/WEB-INF/bundles/postgresql-9.1-901.jdbc4.jar \ && wget https://jdbc.postgresql.org/download/postgresql-42.2.0.jar -O /srv/tomcat/webapps/motech/WEB-INF/lib/postgresql-42.2.0.jar \ && cp /srv/tomcat/webapps/motech/WEB-INF/lib/postgresql-42.2.0.jar /srv/tomcat/webapps/motech/WEB-INF/bundles/postgresql-42.2.0.jar \ # Configure Tomcat port && sed -i 's/port="8080"/port="8013"/g' /srv/tomcat/conf/server.xml \ # Create OS user && addgroup -S -g 8013 motech \ && adduser -S -u 8013 -h /srv/tomcat -s /bin/false -g motech -G motech motech \ && chown -R motech:motech /srv/tomcat/conf /srv/tomcat/logs /srv/tomcat/temp /srv/tomcat/webapps /srv/tomcat/work \ # Cleanup && rm -f /tmp/motech.war VOLUME ["/srv/tomcat/.motech"] EXPOSE 8013 USER motech WORKDIR /srv/tomcat CMD ["catalina.sh", "run"]