| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 1 | # 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 | |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 16 | FROM ubuntu:20.04 as INSTALL |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 17 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 18 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 19 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 20 | apt-transport-https=2.0.* \ |
| 21 | curl=7.68.* \ |
| sousaedu | e99b45e | 2021-08-12 15:35:51 +0100 | [diff] [blame] | 22 | gnupg2=2.2.* \ |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 23 | nginx=1.18.* \ |
| 24 | software-properties-common=0.99.* \ |
| sousaedu | e99b45e | 2021-08-12 15:35:51 +0100 | [diff] [blame] | 25 | xz-utils=5.2.* |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 26 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 27 | RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 28 | 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.* |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 31 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 32 | ARG OSM_NGUI_URL |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 33 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 34 | RUN curl $OSM_NGUI_URL -o osm_ngui.deb |
| 35 | RUN dpkg -i ./osm_ngui.deb |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 36 | |
| 37 | WORKDIR /usr/share/osm-ngui |
| 38 | RUN npm install |
| Felipe Vicens | 5591174 | 2020-06-23 08:59:42 +0200 | [diff] [blame] | 39 | |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 40 | # Building app. |
| 41 | RUN npm run build |
| sousaedu | 1852a4b | 2021-11-18 13:15:38 +0000 | [diff] [blame] | 42 | |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 43 | ####################################################################################### |
| 44 | FROM ubuntu:20.04 AS FINAL |
| 45 | |
| 46 | ARG APT_PROXY |
| 47 | RUN 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 |
| sousaedu | 1852a4b | 2021-11-18 13:15:38 +0000 | [diff] [blame] | 51 | |
| 52 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 53 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 54 | nginx=1.18.* && \ |
| sousaedu | 1852a4b | 2021-11-18 13:15:38 +0000 | [diff] [blame] | 55 | rm -rf /var/lib/apt/lists/* |
| Felipe Vicens | 5591174 | 2020-06-23 08:59:42 +0200 | [diff] [blame] | 56 | |
| 57 | # Removing the Nginx default page. |
| 58 | RUN rm -rf /usr/share/nginx/html/* |
| 59 | |
| sousaedu | 1852a4b | 2021-11-18 13:15:38 +0000 | [diff] [blame] | 60 | # Copying Nginx configuration |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 61 | COPY --from=INSTALL /usr/share/osm-ngui/nginx/nginx.conf /etc/nginx/sites-available/default |
| sousaedu | 1852a4b | 2021-11-18 13:15:38 +0000 | [diff] [blame] | 62 | |
| Felipe Vicens | 5591174 | 2020-06-23 08:59:42 +0200 | [diff] [blame] | 63 | # Copying angular build to Nginx default page. |
| beierlm | 5a6d112 | 2022-01-26 10:18:21 -0500 | [diff] [blame] | 64 | COPY --from=INSTALL /usr/share/osm-ngui/dist/osm /usr/share/nginx/html |
| garciadeblas | 9887bb4 | 2020-06-08 09:55:28 +0000 | [diff] [blame] | 65 | |
| 66 | EXPOSE 80 |
| 67 | |
| 68 | HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \ |
| 69 | CMD curl --silent --fail localhost:80 || exit 1 |
| 70 | |
| 71 | # Starting server. |
| 72 | CMD ["nginx", "-g", "daemon off;"] |