blob: 29b1ae48b4f9730bbe07f02e2f2fd7ebd8b1117f [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
beierlm7278f0a2022-01-26 10:18:21 -050016FROM ubuntu:20.04 as INSTALL
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 \
beierlm7278f0a2022-01-26 10:18:21 -050020 apt-transport-https=2.0.* \
21 curl=7.68.* \
sousaedufd164af2021-08-12 15:35:51 +010022 gnupg2=2.2.* \
beierlm7278f0a2022-01-26 10:18:21 -050023 nginx=1.18.* \
24 software-properties-common=0.99.* \
sousaedufd164af2021-08-12 15:35:51 +010025 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 - && \
beierlm7278f0a2022-01-26 10:18:21 -050028 echo "deb https://deb.nodesource.com/node_10.x focal main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
29 DEBIAN_FRONTEND=noninteractive apt-get update && \
30 DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs=10.24.*
garciadeblas9887bb42020-06-08 09:55:28 +000031
David Garciaa60ec732021-03-17 15:28:47 +010032ARG OSM_NGUI_URL
garciadeblas9887bb42020-06-08 09:55:28 +000033
David Garciaa60ec732021-03-17 15:28:47 +010034RUN curl $OSM_NGUI_URL -o osm_ngui.deb
35RUN dpkg -i ./osm_ngui.deb
garciadeblas9887bb42020-06-08 09:55:28 +000036
37WORKDIR /usr/share/osm-ngui
38RUN npm install
Felipe Vicens55911742020-06-23 08:59:42 +020039
garciadeblas9887bb42020-06-08 09:55:28 +000040# Building app.
41RUN npm run build
sousaedu71b7ad62021-11-18 13:15:38 +000042
beierlm7278f0a2022-01-26 10:18:21 -050043#######################################################################################
44FROM ubuntu:20.04 AS FINAL
45
46ARG APT_PROXY
47RUN if [ ! -z $APT_PROXY ] ; then \
48 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
49 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
50 fi
sousaedu71b7ad62021-11-18 13:15:38 +000051
52RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
53 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
beierlm7278f0a2022-01-26 10:18:21 -050054 nginx=1.18.* && \
sousaedu71b7ad62021-11-18 13:15:38 +000055 rm -rf /var/lib/apt/lists/*
Felipe Vicens55911742020-06-23 08:59:42 +020056
57# Removing the Nginx default page.
58RUN rm -rf /usr/share/nginx/html/*
59
sousaedu71b7ad62021-11-18 13:15:38 +000060# Copying Nginx configuration
beierlm7278f0a2022-01-26 10:18:21 -050061COPY --from=INSTALL /usr/share/osm-ngui/nginx/nginx.conf /etc/nginx/sites-available/default
sousaedu71b7ad62021-11-18 13:15:38 +000062
Felipe Vicens55911742020-06-23 08:59:42 +020063# Copying angular build to Nginx default page.
beierlm7278f0a2022-01-26 10:18:21 -050064COPY --from=INSTALL /usr/share/osm-ngui/dist/osm /usr/share/nginx/html
garciadeblas9887bb42020-06-08 09:55:28 +000065
66EXPOSE 80
67
68HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
69 CMD curl --silent --fail localhost:80 || exit 1
70
71# Starting server.
72CMD ["nginx", "-g", "daemon off;"]