aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/Dockerfile
blob: 6a9eaa56dfe24d137b0939642b4be85be10b6d0b (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright 2020 Huawei Technologies Co., Ltd.
# Copyright 2020 Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# vnf-sdk-marketplace/target/Dockerfile
#

# 10-basebuild.txt

FROM openjdk:11-jre-slim
ARG DEBIAN_FRONTEND=noninteractive

ENV JAVA_VERSION_MAJOR=11 \
    JAVA_VERSION_MINOR=08 \
    JAVA_HOME=/usr/lib/jvm/default-jvm \
    PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ \
    CATALINA_HOME=/service

# Install required libraries
RUN apt-get update && apt-get install -y \
    curl \
    procps \
    g++ \
    make \
    nano \
    nginx \
    nodejs \
    npm \
    sudo \
    unzip \
    wget \
 && rm -rf /var/lib/apt/lists/* \
 && sudo mkdir -p /usr/lib/jvm/default-jvm \
 && sudo ln -s /usr/local/openjdk-11/* /usr/lib/jvm/default-jvm

# Download and set up Tomcat
WORKDIR /service
RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz && \
    tar --strip-components=1 -xf apache-tomcat-8.5.30.tar.gz && \
    rm -f apache-tomcat-8.5.30.tar.gz && rm -rf webapps && mkdir -p webapps/ROOT && \
    echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > /service/bin/setenv.sh

# Copy artifacts
WORKDIR /service
COPY nginx.conf /etc/nginx/nginx.conf
COPY certgen.sh /service
COPY instance-config.sh .
COPY instance-init.sh .
COPY instance-run.sh .
COPY instance-workaround.sh .
COPY docker-entrypoint.sh .
COPY install-vtp.sh .
COPY vtp-tc.sh .
COPY LICENSE ./ONAP_LICENSE

# Configure NGINX
RUN mkdir -p /etc/nginx/ssl && \
    chown -R www-data:www-data /var/lib/nginx

# Generate certificates
RUN chmod +x /service/certgen.sh  && \
    /service/certgen.sh

# Set up microservice
ADD ./STAGE  /service
RUN chmod +x /service/bin/*.sh && \
    cd /service/webapps/onapui/vnfmarket && \
    npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && \
    npm install

# VTP setup
RUN chmod a+x /service/install-vtp.sh && \
    chmod a+x /service/vtp-tc.sh && \
    /service/install-vtp.sh

# Create group and user
RUN groupadd -r vnfadmin && useradd -m --no-log-init -r -g vnfadmin vnfadmin && \
    usermod -aG sudo vnfadmin && echo "vnfadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
    chmod -R 777 /usr/local/

USER vnfadmin

# Define mountable directories.
VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]

EXPOSE 8702
EXPOSE 8703
EXPOSE 50051

ENTRYPOINT ["/service/docker-entrypoint.sh"]