Dockerfile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
  2. FROM tomcat:8.0-jre8
  3. MAINTAINER Tim Sutton<tim@linfiniti.com>
  4. RUN export DEBIAN_FRONTEND=noninteractive
  5. ENV DEBIAN_FRONTEND noninteractive
  6. RUN dpkg-divert --local --rename --add /sbin/initctl
  7. #RUN ln -s /bin/true /sbin/initctl
  8. RUN apt-get -y update
  9. #-------------Application Specific Stuff ----------------------------------------------------
  10. ENV GS_VERSION 2.12.0
  11. ENV GEOSERVER_DATA_DIR /opt/geoserver/data_dir
  12. RUN mkdir -p $GEOSERVER_DATA_DIR
  13. # Unset Java related ENVs since they may change with Oracle JDK
  14. ENV JAVA_VERSION=
  15. ENV JAVA_DEBIAN_VERSION=
  16. # Set JAVA_HOME to /usr/lib/jvm/default-java and link it to OpenJDK installation
  17. RUN ln -s /usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/default-java
  18. ENV JAVA_HOME /usr/lib/jvm/default-java
  19. ADD resources /tmp/resources
  20. # If a matching Oracle JDK tar.gz exists in /tmp/resources, move it to /var/cache/oracle-jdk8-installer
  21. # where oracle-java8-installer will detect it
  22. RUN if ls /tmp/resources/*jdk-*-linux-x64.tar.gz > /dev/null 2>&1; then \
  23. mkdir /var/cache/oracle-jdk8-installer && \
  24. mv /tmp/resources/*jdk-*-linux-x64.tar.gz /var/cache/oracle-jdk8-installer/; \
  25. fi;
  26. #Add JAI and ImageIO for great speedy speed.
  27. WORKDIR /tmp
  28. # A little logic that will fetch the JAI and JAI ImageIO tar file if it
  29. # is not available locally in the resources dir
  30. RUN if [ ! -f /tmp/resources/jai-1_1_3-lib-linux-amd64.tar.gz ]; then \
  31. wget http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-amd64.tar.gz -P ./resources;\
  32. fi; \
  33. if [ ! -f /tmp/resources/jai_imageio-1_1-lib-linux-amd64.tar.gz ]; then \
  34. wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-amd64.tar.gz -P ./resources;\
  35. fi; \
  36. mv resources/jai-1_1_3-lib-linux-amd64.tar.gz ./ && \
  37. mv resources/jai_imageio-1_1-lib-linux-amd64.tar.gz ./ && \
  38. gunzip -c jai-1_1_3-lib-linux-amd64.tar.gz | tar xf - && \
  39. gunzip -c jai_imageio-1_1-lib-linux-amd64.tar.gz | tar xf - && \
  40. mv /tmp/jai-1_1_3/lib/*.jar $JAVA_HOME/jre/lib/ext/ && \
  41. mv /tmp/jai-1_1_3/lib/*.so $JAVA_HOME/jre/lib/amd64/ && \
  42. mv /tmp/jai_imageio-1_1/lib/*.jar $JAVA_HOME/jre/lib/ext/ && \
  43. mv /tmp/jai_imageio-1_1/lib/*.so $JAVA_HOME/jre/lib/amd64/ && \
  44. rm /tmp/jai-1_1_3-lib-linux-amd64.tar.gz && \
  45. rm -r /tmp/jai-1_1_3 && \
  46. rm /tmp/jai_imageio-1_1-lib-linux-amd64.tar.gz && \
  47. rm -r /tmp/jai_imageio-1_1
  48. WORKDIR $CATALINA_HOME
  49. # A little logic that will fetch the geoserver war zip file if it
  50. # is not available locally in the resources dir
  51. RUN if [ ! -f /tmp/resources/geoserver.zip ]; then \
  52. wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip \
  53. -O /tmp/resources/geoserver.zip; \
  54. fi; \
  55. unzip /tmp/resources/geoserver.zip -d /tmp/geoserver \
  56. && unzip /tmp/geoserver/geoserver.war -d $CATALINA_HOME/webapps/geoserver \
  57. && rm -rf $CATALINA_HOME/webapps/geoserver/data \
  58. && rm -rf /tmp/geoserver
  59. # Optionally remove Tomcat manager, docs, and examples
  60. ARG TOMCAT_EXTRAS=true
  61. RUN if [ "$TOMCAT_EXTRAS" = false ]; then \
  62. rm -rf $CATALINA_HOME/webapps/ROOT && \
  63. rm -rf $CATALINA_HOME/webapps/docs && \
  64. rm -rf $CATALINA_HOME/webapps/examples && \
  65. rm -rf $CATALINA_HOME/webapps/host-manager && \
  66. rm -rf $CATALINA_HOME/webapps/manager; \
  67. fi;
  68. # Delete resources after installation
  69. RUN rm -rf /tmp/resources; \
  70. rm -rf /var/lib/apt/lists/*