blob: 21bb1a2c1d773a79a85527fc6072e866e5227c1b [file] [log] [blame]
stattaa3a04c52019-08-23 16:49:45 -04001# Dockerfile for image with ONAP Portal
2ARG BE_BASE_IMAGE=tomcat:8.5.35-jre8-alpine
3FROM ${BE_BASE_IMAGE}
4
5RUN 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
8ARG PORTAL_WAR=build/ecompportal-be-os.war
9ARG HTTP_PROXY
10ARG HTTPS_PROXY
11# ARG PORTAL_CERT=truststoreONAPall.jks
12
13# Just variables, never passed in
14ARG PORTALCONTEXT=ONAPPORTAL
15
16ARG TOMCAT=/usr/local/tomcat
17ARG TOMCATHOME=${TOMCAT}
18ARG SERVERXML=${SERVERXML}
19
20ENV http_proxy $HTTP_PROXY
21ENV https_proxy $HTTPS_PROXY
22
23RUN 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
27RUN rm -rf ${TOMCAT}/webapps/[a-z]*
28RUN mkdir -p /opt
29COPY ${SERVERXML} ${TOMCAT}/conf
30# TODO: ????
31#RUN mv ${TOMCAT} /opt
32
33WORKDIR ${TOMCATHOME}/webapps
34RUN mkdir ${PORTALCONTEXT}
35
36# Portal has many parts
37COPY $PORTAL_WAR ${PORTALCONTEXT}
38RUN cd ${PORTALCONTEXT} && unzip -q *.war && rm *.war
39
40VOLUME ${TOMCATHOME}/logs
41
Pawel Wieczorek047385e2020-03-30 11:40:12 +020042# Switch to unprivileged user
stattaa3a04c52019-08-23 16:49:45 -040043RUN 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 Wieczorek047385e2020-03-30 11:40:12 +020044USER portal
stattaa3a04c52019-08-23 16:49:45 -040045
46# Switch back to root
47WORKDIR /
48
49# Define commonly used ENV variables
50ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin
51# Install the launch script
52COPY start-apache-tomcat.sh /
53
54# Define default command
55ENV TOMCATHOME=$TOMCATHOME
56CMD /start-apache-tomcat.sh -b $TOMCATHOME