statta | a3a04c5 | 2019-08-23 16:49:45 -0400 | [diff] [blame] | 1 | # Dockerfile for image with ONAP Portal |
| 2 | ARG BE_BASE_IMAGE=tomcat:8.5.35-jre8-alpine |
| 3 | FROM ${BE_BASE_IMAGE} |
| 4 | |
| 5 | RUN apk add sudo && echo "portal ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers |
| 6 | # Arguments are supplied by build.sh script |
| 7 | # the defaults below only support testing |
| 8 | ARG PORTAL_WAR=build/ecompportal-be-os.war |
| 9 | ARG HTTP_PROXY |
| 10 | ARG HTTPS_PROXY |
| 11 | # ARG PORTAL_CERT=truststoreONAPall.jks |
| 12 | |
| 13 | # Just variables, never passed in |
| 14 | ARG PORTALCONTEXT=ONAPPORTAL |
| 15 | |
| 16 | ARG TOMCAT=/usr/local/tomcat |
| 17 | ARG TOMCATHOME=${TOMCAT} |
| 18 | ARG SERVERXML=${SERVERXML} |
| 19 | |
| 20 | ENV http_proxy $HTTP_PROXY |
| 21 | ENV https_proxy $HTTPS_PROXY |
| 22 | |
| 23 | RUN if [ -d /etc/apt ] && [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \ |
| 24 | if [ -d /etc/apt ] && [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi |
| 25 | |
| 26 | # Remove manager and sample apps |
| 27 | RUN rm -rf ${TOMCAT}/webapps/[a-z]* |
| 28 | RUN mkdir -p /opt |
| 29 | COPY ${SERVERXML} ${TOMCAT}/conf |
| 30 | # TODO: ???? |
| 31 | #RUN mv ${TOMCAT} /opt |
| 32 | |
| 33 | WORKDIR ${TOMCATHOME}/webapps |
| 34 | RUN mkdir ${PORTALCONTEXT} |
| 35 | |
| 36 | # Portal has many parts |
| 37 | COPY $PORTAL_WAR ${PORTALCONTEXT} |
| 38 | RUN cd ${PORTALCONTEXT} && unzip -q *.war && rm *.war |
| 39 | |
| 40 | VOLUME ${TOMCATHOME}/logs |
| 41 | |
Pawel Wieczorek | 047385e | 2020-03-30 11:40:12 +0200 | [diff] [blame] | 42 | # Switch to unprivileged user |
statta | a3a04c5 | 2019-08-23 16:49:45 -0400 | [diff] [blame] | 43 | RUN addgroup -g 1000 -S portal && adduser -u 1000 -S portal -G portal && chown -R portal:portal . && chmod -R 777 /etc/ssl/certs/java /var/ |
Pawel Wieczorek | 047385e | 2020-03-30 11:40:12 +0200 | [diff] [blame] | 44 | USER portal |
statta | a3a04c5 | 2019-08-23 16:49:45 -0400 | [diff] [blame] | 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 | ENV TOMCATHOME=$TOMCATHOME |
| 56 | CMD /start-apache-tomcat.sh -b $TOMCATHOME |