78643d42cc6d5636b1e9bffc8fbd41e01a8efbd6
[osm/NG-UI.git] / docker / Dockerfile
1 # Copyright 2020 TATA ELXSI
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 #
16 # Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in), VIJAY NAG (vijaynag.bs@tataelxsi.co.in)
17
18 FROM ubuntu:16.04
19 # Installing node dependencies.
20 RUN apt-get update && apt-get install -y curl xz-utils gnupg2 \
21     && apt-get update && apt-get install -y apt-transport-https \
22     && curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
23     && echo "deb https://deb.nodesource.com/node_10.x xenial main" | tee -a /etc/apt/sources.list.d/nodesource.list \
24     && echo "deb-src https://deb.nodesource.com/node_10.x xenial main" | tee -a /etc/apt/sources.list.d/nodesource.list \
25     && apt-get update && apt-get install -y nodejs \
26     && apt-get install -y nginx
27
28 # Preparing working environment.
29 RUN mkdir -p /usr/src/osm-angularapp
30 WORKDIR /usr/src/osm-angularapp
31
32 # Installing dependencies.
33 COPY ./package.json /usr/src/osm-angularapp/
34 RUN npm install
35
36 # Copy osm-angularapp source into image.
37 COPY ./ /usr/src/osm-angularapp
38
39 # Building app.
40 RUN npm run build
41
42 # Removing nginx default page.
43 RUN rm -rf /usr/share/nginx/html/*
44
45 # Copying nginx configuration.
46 COPY nginx/nginx.conf /etc/nginx/sites-available/default
47 RUN cp -r /usr/src/osm-angularapp/dist/osm/* /usr/share/nginx/html
48
49 # Exposing ports.
50 EXPOSE 80
51
52 # Starting server.
53 CMD ["nginx", "-g", "daemon off;"]
54