st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 1 | # Dockerfile for image with ONAP Portal |
statta | e10ac25 | 2019-09-09 11:58:00 -0400 | [diff] [blame] | 2 | ARG BE_BASE_IMAGE=tomcat:8.5.35-jre8-alpine |
| 3 | FROM ${BE_BASE_IMAGE} |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 4 | |
statta | e10ac25 | 2019-09-09 11:58:00 -0400 | [diff] [blame] | 5 | RUN apk add sudo && echo "portal ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 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 FE_DIR=build/public |
| 10 | ARG HTTP_PROXY |
| 11 | ARG HTTPS_PROXY |
Kishore Reddy, Gujja (kg811t) | a59bc3e | 2018-09-25 13:59:56 -0400 | [diff] [blame] | 12 | # ARG PORTAL_CERT=truststoreONAPall.jks |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 13 | |
| 14 | # Just variables, never passed in |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 15 | ARG PORTALCONTEXT=ONAPPORTAL |
| 16 | |
statta | e10ac25 | 2019-09-09 11:58:00 -0400 | [diff] [blame] | 17 | ARG TOMCAT=/usr/local/tomcat |
| 18 | ARG TOMCATHOME=${TOMCAT} |
| 19 | ARG SERVERXML=${SERVERXML} |
| 20 | |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 21 | ENV http_proxy $HTTP_PROXY |
| 22 | ENV https_proxy $HTTPS_PROXY |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 23 | |
statta | e10ac25 | 2019-09-09 11:58:00 -0400 | [diff] [blame] | 24 | RUN if [ -d /etc/apt ] && [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \ |
| 25 | if [ -d /etc/apt ] && [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 26 | |
statta | e10ac25 | 2019-09-09 11:58:00 -0400 | [diff] [blame] | 27 | # Remove manager and sample apps |
| 28 | RUN rm -rf ${TOMCAT}/webapps/[a-z]* |
| 29 | RUN mkdir -p /opt |
| 30 | COPY ${SERVERXML} ${TOMCAT}/conf |
| 31 | # TODO: ???? |
| 32 | #RUN mv ${TOMCAT} /opt |
| 33 | |
| 34 | WORKDIR ${TOMCATHOME}/webapps |
| 35 | RUN mkdir ${PORTALCONTEXT} |
| 36 | |
| 37 | # Portal has many parts |
| 38 | COPY $PORTAL_WAR ${PORTALCONTEXT} |
| 39 | RUN cd ${PORTALCONTEXT} && unzip -q *.war && rm *.war |
| 40 | COPY ${FE_DIR} ${PORTALCONTEXT}/public |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 41 | |
| 42 | VOLUME ${TOMCATHOME}/logs |
| 43 | |
Pawel Wieczorek | 048ca45 | 2020-03-30 11:43:19 +0200 | [diff] [blame^] | 44 | # Switch to unprivileged user |
| 45 | RUN addgroup -g 1000 -S portal && adduser -u 1000 -S portal -G portal |
| 46 | USER portal |
| 47 | |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 48 | # Switch back to root |
| 49 | WORKDIR / |
| 50 | |
| 51 | # Define commonly used ENV variables |
| 52 | ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin |
| 53 | # Install the launch script |
| 54 | COPY start-apache-tomcat.sh / |
| 55 | |
| 56 | # Define default command |
statta | e10ac25 | 2019-09-09 11:58:00 -0400 | [diff] [blame] | 57 | ENV TOMCATHOME=$TOMCATHOME |
| 58 | CMD /start-apache-tomcat.sh -b $TOMCATHOME |