statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 1 | # Dockerfile for SDK image with ONAP Portal |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 2 | |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 3 | FROM tomcat:8.5.35-jre8-alpine |
Sylvain Desbureaux | 3992004 | 2019-03-04 08:45:37 +0100 | [diff] [blame] | 4 | |
| 5 | # Arguments are supplied by build.sh script |
| 6 | # the defaults below only support testing |
| 7 | ARG SDK_WAR=build/epsdk-app-os.war |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 8 | ARG HTTP_PROXY |
| 9 | ARG HTTPS_PROXY |
| 10 | |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 11 | |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 12 | # Just variables, never passed in |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 13 | ARG SDKCONTEXT=ONAPPORTALSDK |
| 14 | |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 15 | ARG TOMCAT=/usr/local/tomcat |
| 16 | ARG TOMCATHOME=${TOMCAT} |
| 17 | ARG SERVERXML=${SERVERXML} |
Sylvain Desbureaux | 3992004 | 2019-03-04 08:45:37 +0100 | [diff] [blame] | 18 | |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 19 | ENV http_proxy $HTTP_PROXY |
| 20 | ENV https_proxy $HTTPS_PROXY |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 21 | RUN 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 |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 23 | |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 24 | |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 25 | # Remove manager and sample apps |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 26 | RUN rm -rf ${TOMCAT}/webapps/[a-z]* |
| 27 | RUN mkdir -p /opt |
| 28 | COPY ${SERVERXML} ${TOMCAT}/conf |
| 29 | # TODO: ???? |
| 30 | #RUN mv ${TOMCAT} /opt |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 31 | |
statta | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 32 | WORKDIR ${TOMCATHOME}/webapps |
| 33 | RUN mkdir ${SDKCONTEXT} |
| 34 | |
| 35 | # Portal has many parts |
| 36 | COPY $SDK_WAR ${SDKCONTEXT} |
| 37 | RUN cd ${SDKCONTEXT} && unzip -q *.war && rm *.war |
st782s | 21a8761 | 2018-01-30 17:29:36 -0500 | [diff] [blame] | 38 | |
| 39 | VOLUME ${TOMCATHOME}/logs |
| 40 | |
Pawel Wieczorek | 59ad77a | 2020-03-30 11:48:26 +0200 | [diff] [blame] | 41 | # Switch to unprivileged user |
Pawel Wieczorek | 3cd8582 | 2020-04-10 09:52:45 +0200 | [diff] [blame] | 42 | RUN 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 Wieczorek | 59ad77a | 2020-03-30 11:48:26 +0200 | [diff] [blame] | 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 | 5fe839b | 2019-09-12 16:05:58 -0400 | [diff] [blame] | 57 | ENV TOMCATHOME=$TOMCATHOME |
| 58 | CMD /start-apache-tomcat.sh -b $TOMCATHOME |