blob: d855aae0aa6849a01e05796385bdfa4cd711641e [file] [log] [blame]
lombardofr7e29d162019-07-30 15:37:33 +02001# 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
garciadeblas0eb6c8b2020-10-16 11:25:57 +000016FROM ubuntu:18.04
Mike Marchetti13d76c82018-09-19 15:00:36 -040017
garciadeblas0eb6c8b2020-10-16 11:25:57 +000018#RUN apt-get update && apt-get install -y npm git python-pip nginx supervisor curl software-properties-common libssl-dev libmysqlclient-dev mysql-client
19RUN apt-get update \
20 && DEBIAN_FRONTEND=noninteractive apt-get install -y curl \
21 software-properties-common \
22 git \
23 python-pip \
24 nginx \
25 supervisor \
26 libmariadbclient-dev \
27 mysql-client \
28 libssl-dev \
29 apt-utils \
30 && DEBIAN_FRONTEND=noninteractive apt-get install -y npm
31
garciadeblas3fad2ea2018-11-29 16:36:50 +010032RUN echo "daemon off;" >> /etc/nginx/nginx.conf
garciadeblas28f76d92018-11-28 14:15:04 +010033
garciadeblas3fad2ea2018-11-29 16:36:50 +010034ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
garciadeblasfa81f282020-12-15 00:32:13 +000035ARG RELEASE=ReleaseNINE-daily
garciadeblas3fad2ea2018-11-29 16:36:50 +010036ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
37ARG REPOSITORY=testing
38ARG LWUI_VERSION
39
garciadeblas0eb6c8b2020-10-16 11:25:57 +000040RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
garciadeblas3fad2ea2018-11-29 16:36:50 +010041RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LW-UI" && apt-get update
42
garciadeblas0eb6c8b2020-10-16 11:25:57 +000043RUN DEBIAN_FRONTEND=noninteractive apt-get install -y osm-lightui${LWUI_VERSION} \
44 && apt-get clean \
45 && rm -rf /var/lib/apt/lists/*
garciadeblas3fad2ea2018-11-29 16:36:50 +010046
47WORKDIR /usr/share/osm-lightui
garciadeblas0eb6c8b2020-10-16 11:25:57 +000048RUN npm install -g npm@latest
lombardofr8cb84422019-07-16 12:32:01 +020049RUN npm install
lombardofr7e29d162019-07-30 15:37:33 +020050RUN mv node_modules ./static
Mike Marchetti13d76c82018-09-19 15:00:36 -040051RUN pip install -r requirements.txt
52RUN pip install uwsgi
garciadeblas0ce565b2018-10-29 12:22:28 +010053RUN cp /usr/share/osm-lightui/nginx-app.conf /etc/nginx/sites-available/default
54RUN cp /usr/share/osm-lightui/supervisor-app.conf /etc/supervisor/conf.d/
Mike Marchetti13d76c82018-09-19 15:00:36 -040055
56# delete the copy of the database inside the container (if exists)
57RUN rm -f db.sqlite3
58
59ENV DJANGO_ENV=prod
David Garciaab475732020-01-08 13:22:50 +010060ENV OSM_SERVER=nbi
61# ENV OSMUI_SQL_DATABASE_URI=mysql://root:secret@mysql:3306/lwui
Mike Marchetti13d76c82018-09-19 15:00:36 -040062RUN python manage.py collectstatic --noinput
Benjamin Diazc34a5432019-05-24 11:37:22 -030063RUN chmod +x /usr/share/osm-lightui/entrypoint.sh
Mike Marchetti13d76c82018-09-19 15:00:36 -040064
65EXPOSE 80
66
Benjamin Diaz80fa8fa2019-05-24 12:27:10 -030067HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
68 CMD curl --silent --fail localhost:80 || exit 1
69
Benjamin Diazc34a5432019-05-24 11:37:22 -030070CMD ["/usr/share/osm-lightui/entrypoint.sh"]