IMAGE opendatakit_2.0.3-190620

LAYER alpine3.9_3.9.4-190620
LAYER alpine3.9-java8_8.212.04-190620
LAYER alpine3.9-tomcat8.5_8.5.41-190620

RUN EOF
    # Download OpenDataKit
    wget https://github.com/opendatakit/aggregate/releases/download/v2.0.3/ODK-Aggregate-v2.0.3.war -O /tmp/odk.war
    mkdir /srv/tomcat/webapps/ROOT
    unzip /tmp/odk.war -d /srv/tomcat/webapps/ROOT

    # Update Postgres JDBC driver
    rm /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-42.1.4.jre7.jar
    wget https://jdbc.postgresql.org/download/postgresql-42.2.5.jar -O /srv/tomcat/webapps/ROOT/WEB-INF/lib/postgresql-42.2.5.jar

    # Create OS user
    addgroup -S -g 8015 odk
    adduser -S -u 8015 -h /srv/tomcat -s /bin/false -g odk -G odk odk
    chown -R odk:odk /srv/tomcat/conf /srv/tomcat/logs /srv/tomcat/temp /srv/tomcat/webapps /srv/tomcat/work

    # Cleanup
    rm /tmp/odk.war
EOF

MOUNT FILE /srv/opendatakit/conf/server.xml srv/tomcat/conf/server.xml
MOUNT FILE /srv/opendatakit/conf/jdbc.properties srv/tomcat/webapps/ROOT/WEB-INF/classes/jdbc.properties
MOUNT FILE /srv/opendatakit/conf/security.properties srv/tomcat/webapps/ROOT/WEB-INF/classes/security.properties

USER 8015 8015
WORKDIR /srv/tomcat
CMD catalina.sh run