st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 1 | # Dockerfile for image with ONAP Portal |
| 2 | |
| 3 | # Yields an image 823 MB |
| 4 | FROM frolvlad/alpine-oraclejdk8:slim |
| 5 | # Yields an image 1.4 GB |
| 6 | # FROM openjdk:8-jdk |
| 7 | |
| 8 | # Arguments are supplied by build.sh script |
| 9 | # the defaults below only support testing |
| 10 | ARG PORTAL_WAR=build/ecompportal-be-os.war |
| 11 | ARG FE_DIR=build/public |
| 12 | ARG HTTP_PROXY |
| 13 | ARG HTTPS_PROXY |
| 14 | |
| 15 | # Just variables, never passed in |
| 16 | ARG TOMCAT=apache-tomcat-8.0.37 |
| 17 | ARG TOMCATTAR=${TOMCAT}.tar.gz |
| 18 | ARG TOMCATHOME=/opt/${TOMCAT} |
| 19 | ARG PORTALCONTEXT=ONAPPORTAL |
| 20 | |
| 21 | ENV http_proxy $HTTP_PROXY |
| 22 | ENV https_proxy $HTTPS_PROXY |
| 23 | RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \ |
| 24 | if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi |
| 25 | |
| 26 | # Install Tomcat. This image already has curl. |
| 27 | WORKDIR /tmp |
| 28 | RUN wget -q http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin/apache-tomcat-8.0.37.tar.gz |
| 29 | RUN tar -xzf ${TOMCATTAR} |
| 30 | RUN rm ${TOMCATTAR} |
| 31 | # Remove manager and sample apps |
| 32 | RUN rm -fr ${TOMCAT}/webapps/[a-z]* |
| 33 | RUN mkdir -p /opt |
| 34 | RUN mv ${TOMCAT} /opt |
| 35 | |
| 36 | WORKDIR ${TOMCATHOME}/webapps |
| 37 | RUN mkdir ${PORTALCONTEXT} |
| 38 | |
| 39 | # Portal has many parts |
| 40 | COPY $PORTAL_WAR ${PORTALCONTEXT} |
| 41 | RUN cd ${PORTALCONTEXT} && unzip -q *.war && rm *.war |
| 42 | COPY ${FE_DIR} ${PORTALCONTEXT}/public |
| 43 | |
| 44 | VOLUME ${TOMCATHOME}/logs |
| 45 | |
| 46 | # Switch back to root |
| 47 | WORKDIR / |
| 48 | |
| 49 | # Define commonly used ENV variables |
| 50 | ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin |
| 51 | # Install the launch script |
| 52 | COPY start-apache-tomcat.sh / |
| 53 | |
| 54 | # Define default command |
| 55 | CMD /start-apache-tomcat.sh |