summaryrefslogtreecommitdiffstats
path: root/deliveries/Dockerfile.sdk
blob: b85cf8466aaf39097414775d1d1c6a57247bfa1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Dockerfile for SDK image with ONAP Portal

FROM tomcat:8.5.35-jre8-alpine

# Arguments are supplied by build.sh script
# the defaults below only support testing
ARG SDK_WAR=build/epsdk-app-os.war
ARG HTTP_PROXY
ARG HTTPS_PROXY


# Just variables, never passed in
ARG SDKCONTEXT=ONAPPORTALSDK

ARG TOMCAT=/usr/local/tomcat
ARG TOMCATHOME=${TOMCAT}
ARG SERVERXML=${SERVERXML}

ENV http_proxy $HTTP_PROXY
ENV https_proxy $HTTPS_PROXY
RUN if [ -d /etc/apt ] && [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy  \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \
    if [ -d /etc/apt ] && [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi


# Remove manager and sample apps
RUN rm -rf ${TOMCAT}/webapps/[a-z]*
RUN mkdir -p /opt
COPY ${SERVERXML} ${TOMCAT}/conf
# TODO: ????
#RUN mv ${TOMCAT} /opt

WORKDIR ${TOMCATHOME}/webapps
RUN mkdir ${SDKCONTEXT}

# Portal has many parts
COPY $SDK_WAR ${SDKCONTEXT}
RUN cd ${SDKCONTEXT} && unzip -q *.war && rm *.war

VOLUME ${TOMCATHOME}/logs

# Switch to unprivileged user
RUN addgroup -g 1000 -S portal && \
    adduser -u 1000 -S portal -G portal && \
    mkdir -p ${TOMCATHOME}/temp && \
    chown portal:portal ${TOMCATHOME}/temp
USER portal

# Switch back to root
WORKDIR /

# Define commonly used ENV variables
ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin
# Install the launch script
COPY start-apache-tomcat.sh /

# Define default command
ENV TOMCATHOME=$TOMCATHOME
CMD /start-apache-tomcat.sh -b $TOMCATHOME