blob: 53ec2a9dbecc689af8725bfc4e9c84ef468202c0 [file] [log] [blame]
garciadeblas9887bb42020-06-08 09:55:28 +00001# Copyright 2020 ETSI
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
sousaedu1852a4b2021-11-18 13:15:38 +000016FROM ubuntu:18.04 AS BUILD
garciadeblas9887bb42020-06-08 09:55:28 +000017
David Garciaa60ec732021-03-17 15:28:47 +010018RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
19 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
sousaedue99b45e2021-08-12 15:35:51 +010020 apt-transport-https=1.6.* \
21 curl=7.58.* \
22 gnupg2=2.2.* \
23 nginx=1.14.* \
24 software-properties-common=0.96.* \
25 xz-utils=5.2.*
garciadeblas9887bb42020-06-08 09:55:28 +000026
David Garciaa60ec732021-03-17 15:28:47 +010027RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
28 echo "deb https://deb.nodesource.com/node_10.x xenial main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
29 apt-get update && \
garciadeblasd992a952021-09-23 17:43:15 +020030 apt-get install -y nodejs=10.24.* \
31 && rm -rf /var/lib/apt/lists/*
garciadeblas9887bb42020-06-08 09:55:28 +000032
David Garciaa60ec732021-03-17 15:28:47 +010033ARG OSM_NGUI_URL
garciadeblas9887bb42020-06-08 09:55:28 +000034
David Garciaa60ec732021-03-17 15:28:47 +010035RUN curl $OSM_NGUI_URL -o osm_ngui.deb
36RUN dpkg -i ./osm_ngui.deb
garciadeblas9887bb42020-06-08 09:55:28 +000037
38WORKDIR /usr/share/osm-ngui
39RUN npm install
Felipe Vicens55911742020-06-23 08:59:42 +020040
garciadeblas9887bb42020-06-08 09:55:28 +000041# Building app.
42RUN npm run build
sousaedu1852a4b2021-11-18 13:15:38 +000043
44FROM ubuntu:18.04 AS FINAL
45
46RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
47 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
48 nginx=1.14.* && \
49 rm -rf /var/lib/apt/lists/*
Felipe Vicens55911742020-06-23 08:59:42 +020050
51# Removing the Nginx default page.
52RUN rm -rf /usr/share/nginx/html/*
53
sousaedu1852a4b2021-11-18 13:15:38 +000054# Copying Nginx configuration
55COPY --from=BUILD /usr/share/osm-ngui/nginx/nginx.conf /etc/nginx/sites-available/default
56
Felipe Vicens55911742020-06-23 08:59:42 +020057# Copying angular build to Nginx default page.
sousaedu1852a4b2021-11-18 13:15:38 +000058COPY --from=BUILD /usr/share/osm-ngui/dist/osm /usr/share/nginx/html
garciadeblas9887bb42020-06-08 09:55:28 +000059
60EXPOSE 80
61
62HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
63 CMD curl --silent --fail localhost:80 || exit 1
64
65# Starting server.
66CMD ["nginx", "-g", "daemon off;"]