# vim:set ft=dockerfile:
FROM tomcat:8-jre8
MAINTAINER ymh, dev__at__iri-research.org

RUN mkdir -p /var/log/cas \
	&& chown -R www-data /var/log/cas \
	&& mkdir -p /etc/cas
RUN mkdir -p /usr/local/tomcat/webapps \
	&& mkdir -p /usr/local/tomcat/ssl

# add war of application
ADD cas.war /usr/local/tomcat/webapps/cas.war
ADD simple-cas4-overlay-template/etc/cas.properties /etc/cas/cas.properties
ADD simple-cas4-overlay-template/etc/log4j.xml /etc/cas/log4j.xml
ADD server.xml /usr/local/tomcat/conf/server.xml
ADD server.keystore /usr/local/tomcat/ssl/server.keystore
ADD client.truststore /usr/local/tomcat/ssl/client.truststore
ADD homestead.app.der /usr/local/tomcat/ssl/homestead.app.der
RUN keytool -import -keystore /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts -file /usr/local/tomcat/ssl/homestead.app.der -storepass changeit -noprompt -trustcacerts

EXPOSE 8080 8443
CMD ["catalina.sh", "run"]
