| lombardofr | 7e29d16 | 2019-07-30 15:37:33 +0200 | [diff] [blame] | 1 | # Copyright 2019 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 | |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 16 | FROM ubuntu:18.04 |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 17 | |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 18 | #RUN apt-get update && apt-get install -y npm git python-pip nginx supervisor curl software-properties-common libssl-dev libmysqlclient-dev mysql-client |
| 19 | RUN apt-get update \ |
| 20 | && DEBIAN_FRONTEND=noninteractive apt-get install -y curl \ |
| 21 | software-properties-common \ |
| fonsecaj | c9bba30 | 2021-02-03 10:27:58 +0000 | [diff] [blame^] | 22 | apt-transport-https \ |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 23 | git \ |
| 24 | python-pip \ |
| 25 | nginx \ |
| 26 | supervisor \ |
| 27 | libmariadbclient-dev \ |
| 28 | mysql-client \ |
| 29 | libssl-dev \ |
| 30 | apt-utils \ |
| fonsecaj | c9bba30 | 2021-02-03 10:27:58 +0000 | [diff] [blame^] | 31 | && curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ |
| 32 | && echo "deb https://deb.nodesource.com/node_10.x bionic main" | tee -a /etc/apt/sources.list.d/nodesource.list \ |
| 33 | && echo "deb-src https://deb.nodesource.com/node_10.x bionic main" | tee -a /etc/apt/sources.list.d/nodesource.list \ |
| 34 | && apt-get update \ |
| 35 | && DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs |
| 36 | |
| 37 | RUN node -v |
| 38 | RUN npm -v |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 39 | |
| garciadeblas | 3fad2ea | 2018-11-29 16:36:50 +0100 | [diff] [blame] | 40 | RUN echo "daemon off;" >> /etc/nginx/nginx.conf |
| garciadeblas | 28f76d9 | 2018-11-28 14:15:04 +0100 | [diff] [blame] | 41 | |
| garciadeblas | 3fad2ea | 2018-11-29 16:36:50 +0100 | [diff] [blame] | 42 | ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian |
| garciadeblas | fa81f28 | 2020-12-15 00:32:13 +0000 | [diff] [blame] | 43 | ARG RELEASE=ReleaseNINE-daily |
| garciadeblas | 3fad2ea | 2018-11-29 16:36:50 +0100 | [diff] [blame] | 44 | ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg |
| 45 | ARG REPOSITORY=testing |
| 46 | ARG LWUI_VERSION |
| 47 | |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 48 | RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - |
| garciadeblas | 3fad2ea | 2018-11-29 16:36:50 +0100 | [diff] [blame] | 49 | RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LW-UI" && apt-get update |
| 50 | |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 51 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y osm-lightui${LWUI_VERSION} \ |
| 52 | && apt-get clean \ |
| 53 | && rm -rf /var/lib/apt/lists/* |
| garciadeblas | 3fad2ea | 2018-11-29 16:36:50 +0100 | [diff] [blame] | 54 | |
| 55 | WORKDIR /usr/share/osm-lightui |
| garciadeblas | 0eb6c8b | 2020-10-16 11:25:57 +0000 | [diff] [blame] | 56 | RUN npm install -g npm@latest |
| lombardofr | 8cb8442 | 2019-07-16 12:32:01 +0200 | [diff] [blame] | 57 | RUN npm install |
| lombardofr | 7e29d16 | 2019-07-30 15:37:33 +0200 | [diff] [blame] | 58 | RUN mv node_modules ./static |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 59 | RUN pip install -r requirements.txt |
| 60 | RUN pip install uwsgi |
| garciadeblas | 0ce565b | 2018-10-29 12:22:28 +0100 | [diff] [blame] | 61 | RUN cp /usr/share/osm-lightui/nginx-app.conf /etc/nginx/sites-available/default |
| 62 | RUN cp /usr/share/osm-lightui/supervisor-app.conf /etc/supervisor/conf.d/ |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 63 | |
| 64 | # delete the copy of the database inside the container (if exists) |
| 65 | RUN rm -f db.sqlite3 |
| 66 | |
| 67 | ENV DJANGO_ENV=prod |
| David Garcia | ab47573 | 2020-01-08 13:22:50 +0100 | [diff] [blame] | 68 | ENV OSM_SERVER=nbi |
| 69 | # ENV OSMUI_SQL_DATABASE_URI=mysql://root:secret@mysql:3306/lwui |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 70 | RUN python manage.py collectstatic --noinput |
| Benjamin Diaz | c34a543 | 2019-05-24 11:37:22 -0300 | [diff] [blame] | 71 | RUN chmod +x /usr/share/osm-lightui/entrypoint.sh |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 72 | |
| 73 | EXPOSE 80 |
| 74 | |
| Benjamin Diaz | 80fa8fa | 2019-05-24 12:27:10 -0300 | [diff] [blame] | 75 | HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \ |
| 76 | CMD curl --silent --fail localhost:80 || exit 1 |
| 77 | |
| Benjamin Diaz | c34a543 | 2019-05-24 11:37:22 -0300 | [diff] [blame] | 78 | CMD ["/usr/share/osm-lightui/entrypoint.sh"] |