blob: b92bfc149d8bcdec5a2b839c342be9ebb8c94915 [file] [log] [blame]
st782s21a87612018-01-30 17:29:36 -05001# Dockerfile for image with ONAP Portal
stattae10ac252019-09-09 11:58:00 -04002ARG BE_BASE_IMAGE=tomcat:8.5.35-jre8-alpine
3FROM ${BE_BASE_IMAGE}
st782s21a87612018-01-30 17:29:36 -05004
stattae10ac252019-09-09 11:58:00 -04005RUN apk add sudo && echo "portal ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
st782s21a87612018-01-30 17:29:36 -05006# Arguments are supplied by build.sh script
7# the defaults below only support testing
8ARG PORTAL_WAR=build/ecompportal-be-os.war
9ARG FE_DIR=build/public
10ARG HTTP_PROXY
11ARG HTTPS_PROXY
Kishore Reddy, Gujja (kg811t)a59bc3e2018-09-25 13:59:56 -040012# ARG PORTAL_CERT=truststoreONAPall.jks
st782s21a87612018-01-30 17:29:36 -050013
14# Just variables, never passed in
st782s21a87612018-01-30 17:29:36 -050015ARG PORTALCONTEXT=ONAPPORTAL
16
stattae10ac252019-09-09 11:58:00 -040017ARG TOMCAT=/usr/local/tomcat
18ARG TOMCATHOME=${TOMCAT}
19ARG SERVERXML=${SERVERXML}
20
st782s21a87612018-01-30 17:29:36 -050021ENV http_proxy $HTTP_PROXY
22ENV https_proxy $HTTPS_PROXY
st782s21a87612018-01-30 17:29:36 -050023
stattae10ac252019-09-09 11:58:00 -040024RUN 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
st782s21a87612018-01-30 17:29:36 -050026
stattae10ac252019-09-09 11:58:00 -040027# Remove manager and sample apps
28RUN rm -rf ${TOMCAT}/webapps/[a-z]*
29RUN mkdir -p /opt
30COPY ${SERVERXML} ${TOMCAT}/conf
31# TODO: ????
32#RUN mv ${TOMCAT} /opt
33
34WORKDIR ${TOMCATHOME}/webapps
35RUN mkdir ${PORTALCONTEXT}
36
37# Portal has many parts
38COPY $PORTAL_WAR ${PORTALCONTEXT}
39RUN cd ${PORTALCONTEXT} && unzip -q *.war && rm *.war
40COPY ${FE_DIR} ${PORTALCONTEXT}/public
st782s21a87612018-01-30 17:29:36 -050041
42VOLUME ${TOMCATHOME}/logs
Sandeep Shahce34d842020-09-15 15:46:01 -050043RUN mkdir -p ${TOMCATHOME}/temp
st782s21a87612018-01-30 17:29:36 -050044
Pawel Wieczorek048ca452020-03-30 11:43:19 +020045# Switch to unprivileged user
46RUN addgroup -g 1000 -S portal && adduser -u 1000 -S portal -G portal
Sandeep Shahce34d842020-09-15 15:46:01 -050047RUN chown portal:portal ${TOMCATHOME}/temp
Pawel Wieczorek048ca452020-03-30 11:43:19 +020048USER portal
49
st782s21a87612018-01-30 17:29:36 -050050WORKDIR /
51
52# Define commonly used ENV variables
53ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin
54# Install the launch script
55COPY start-apache-tomcat.sh /
56
57# Define default command
stattae10ac252019-09-09 11:58:00 -040058ENV TOMCATHOME=$TOMCATHOME
59CMD /start-apache-tomcat.sh -b $TOMCATHOME