blob: cce3ed09c5491c134ad49658d4903d11d9da1002 [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
43
Pawel Wieczorek048ca452020-03-30 11:43:19 +020044# Switch to unprivileged user
45RUN addgroup -g 1000 -S portal && adduser -u 1000 -S portal -G portal
46USER portal
47
st782s21a87612018-01-30 17:29:36 -050048# Switch back to root
49WORKDIR /
50
51# Define commonly used ENV variables
52ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin
53# Install the launch script
54COPY start-apache-tomcat.sh /
55
56# Define default command
stattae10ac252019-09-09 11:58:00 -040057ENV TOMCATHOME=$TOMCATHOME
58CMD /start-apache-tomcat.sh -b $TOMCATHOME