IMAGE dhis2_2.35.1-210106
FROM alpine3.12-tomcat8.5_8.5.61-210106

# https://docs.dhis2.org/master/en/implementer/html/installation.html

RUN EOF
    # Download DHIS2
    wget https://releases.dhis2.org/2.35/dhis2-stable-2.35.1.war -O /tmp/dhis2.war
    mkdir /srv/tomcat/webapps/ROOT
    unzip /tmp/dhis2.war -d /srv/tomcat/webapps/ROOT

    # Change webapps ownership
    chown -R tomcat:tomcat /srv/tomcat/webapps

    # Create DHIS2 data directory
    mkdir /opt/dhis2
    chown tomcat:tomcat /opt/dhis2

    # Cleanup
    rm /tmp/dhis2.war
EOF

USER tomcat
WORKDIR /srv/tomcat
CMD /usr/bin/catalina.sh run
