blob: 2cec812be3524e10c9358d379d2c677c1654d2f1 [file] [log] [blame]
beierlme7646252022-01-13 10:53:08 -05001#######################################################################################
2# Copyright ETSI Contributors and Others.
garciadeblas9887bb42020-06-08 09:55:28 +00003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
beierlme7646252022-01-13 10:53:08 -050016#######################################################################################
garciadeblas9887bb42020-06-08 09:55:28 +000017
garciadeblasecc48d92023-06-08 17:23:24 +020018FROM ubuntu:22.04 as INSTALL
garciadeblas9887bb42020-06-08 09:55:28 +000019
beierlme7646252022-01-13 10:53:08 -050020ARG APT_PROXY
21RUN if [ ! -z $APT_PROXY ] ; then \
22 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
23 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
24 fi
25
David Garciaa60ec732021-03-17 15:28:47 +010026RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
27 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblasecc48d92023-06-08 17:23:24 +020028 apt-transport-https=2.4.* \
29 curl=7.81.* \
sousaedufd164af2021-08-12 15:35:51 +010030 gnupg2=2.2.* \
beierlmd7449362022-01-13 10:53:08 -050031 nginx=1.18.* \
32 software-properties-common=0.99.* \
garciadeblasecc48d92023-06-08 17:23:24 +020033 xz-utils=5.2.* \
34 && rm -rf /var/lib/apt/lists/*
garciadeblas9887bb42020-06-08 09:55:28 +000035
caviedesj7f2f5492026-01-28 17:20:28 +010036# Install Node using NVM
37ENV NVM_VERSION="v0.40.3" \
38 NVM_DIR=/root/.nvm \
39 NODE_VERSION=14
40RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | bash
41RUN bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION; nvm use $NODE_VERSION"
garciadeblas9887bb42020-06-08 09:55:28 +000042
garciadeblasdc4f9ad2023-07-07 10:22:49 +020043ARG CACHE_DATE=not_a_date
David Garciaa60ec732021-03-17 15:28:47 +010044ARG OSM_NGUI_URL
garciadeblas9887bb42020-06-08 09:55:28 +000045
David Garciaa60ec732021-03-17 15:28:47 +010046RUN curl $OSM_NGUI_URL -o osm_ngui.deb
47RUN dpkg -i ./osm_ngui.deb
garciadeblas9887bb42020-06-08 09:55:28 +000048
49WORKDIR /usr/share/osm-ngui
caviedesj7f2f5492026-01-28 17:20:28 +010050RUN bash -c "source $NVM_DIR/nvm.sh && npm install; npm run build"
sousaedu6ec3de52021-11-18 13:15:38 +000051
beierlmd7449362022-01-13 10:53:08 -050052#######################################################################################
garciadeblasecc48d92023-06-08 17:23:24 +020053FROM ubuntu:22.04 AS FINAL
beierlmd7449362022-01-13 10:53:08 -050054
55ARG APT_PROXY
56RUN if [ ! -z $APT_PROXY ] ; then \
57 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
58 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
59 fi
sousaedu6ec3de52021-11-18 13:15:38 +000060
61RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
62 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
beierlmd7449362022-01-13 10:53:08 -050063 nginx=1.18.* && \
sousaedu6ec3de52021-11-18 13:15:38 +000064 rm -rf /var/lib/apt/lists/*
Felipe Vicens55911742020-06-23 08:59:42 +020065
Mark Beierle5b9ba62022-09-08 05:44:06 -040066RUN rm -f /etc/apt/apt.conf.d/proxy.conf
67
Felipe Vicens55911742020-06-23 08:59:42 +020068# Removing the Nginx default page.
69RUN rm -rf /usr/share/nginx/html/*
70
sousaedu6ec3de52021-11-18 13:15:38 +000071# Copying Nginx configuration
beierlmd7449362022-01-13 10:53:08 -050072COPY --from=INSTALL /usr/share/osm-ngui/nginx/nginx.conf /etc/nginx/sites-available/default
sousaedu6ec3de52021-11-18 13:15:38 +000073
Felipe Vicens55911742020-06-23 08:59:42 +020074# Copying angular build to Nginx default page.
beierlmd7449362022-01-13 10:53:08 -050075COPY --from=INSTALL /usr/share/osm-ngui/dist/osm /usr/share/nginx/html
garciadeblas9887bb42020-06-08 09:55:28 +000076
77EXPOSE 80
78
79HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
80 CMD curl --silent --fail localhost:80 || exit 1
81
82# Starting server.
83CMD ["nginx", "-g", "daemon off;"]