blob: b85cf8466aaf39097414775d1d1c6a57247bfa1e [file] [log] [blame]
statta5fe839b2019-09-12 16:05:58 -04001# Dockerfile for SDK image with ONAP Portal
st782s21a87612018-01-30 17:29:36 -05002
statta5fe839b2019-09-12 16:05:58 -04003FROM tomcat:8.5.35-jre8-alpine
Sylvain Desbureaux39920042019-03-04 08:45:37 +01004
5# Arguments are supplied by build.sh script
6# the defaults below only support testing
7ARG SDK_WAR=build/epsdk-app-os.war
st782s21a87612018-01-30 17:29:36 -05008ARG HTTP_PROXY
9ARG HTTPS_PROXY
10
statta5fe839b2019-09-12 16:05:58 -040011
st782s21a87612018-01-30 17:29:36 -050012# Just variables, never passed in
st782s21a87612018-01-30 17:29:36 -050013ARG SDKCONTEXT=ONAPPORTALSDK
14
statta5fe839b2019-09-12 16:05:58 -040015ARG TOMCAT=/usr/local/tomcat
16ARG TOMCATHOME=${TOMCAT}
17ARG SERVERXML=${SERVERXML}
Sylvain Desbureaux39920042019-03-04 08:45:37 +010018
st782s21a87612018-01-30 17:29:36 -050019ENV http_proxy $HTTP_PROXY
20ENV https_proxy $HTTPS_PROXY
statta5fe839b2019-09-12 16:05:58 -040021RUN if [ -d /etc/apt ] && [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \
22 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 -050023
statta5fe839b2019-09-12 16:05:58 -040024
st782s21a87612018-01-30 17:29:36 -050025# Remove manager and sample apps
statta5fe839b2019-09-12 16:05:58 -040026RUN rm -rf ${TOMCAT}/webapps/[a-z]*
27RUN mkdir -p /opt
28COPY ${SERVERXML} ${TOMCAT}/conf
29# TODO: ????
30#RUN mv ${TOMCAT} /opt
st782s21a87612018-01-30 17:29:36 -050031
statta5fe839b2019-09-12 16:05:58 -040032WORKDIR ${TOMCATHOME}/webapps
33RUN mkdir ${SDKCONTEXT}
34
35# Portal has many parts
36COPY $SDK_WAR ${SDKCONTEXT}
37RUN cd ${SDKCONTEXT} && unzip -q *.war && rm *.war
st782s21a87612018-01-30 17:29:36 -050038
39VOLUME ${TOMCATHOME}/logs
40
Pawel Wieczorek59ad77a2020-03-30 11:48:26 +020041# Switch to unprivileged user
Pawel Wieczorek3cd85822020-04-10 09:52:45 +020042RUN addgroup -g 1000 -S portal && \
43 adduser -u 1000 -S portal -G portal && \
44 mkdir -p ${TOMCATHOME}/temp && \
45 chown portal:portal ${TOMCATHOME}/temp
Pawel Wieczorek59ad77a2020-03-30 11:48:26 +020046USER 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
statta5fe839b2019-09-12 16:05:58 -040057ENV TOMCATHOME=$TOMCATHOME
58CMD /start-apache-tomcat.sh -b $TOMCATHOME