blob: 00dba2cd793117f92fbe353d981b1b14c0ec3460 [file] [log] [blame]
Skip Wonnell2c977e22018-03-01 08:30:15 -06001
2# ============LICENSE_START==========================================
3#===================================================================
4#Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
5#===================================================================
6
7#Unless otherwise specified, all software contained herein is licensed
8#under the Apache License, Version 2.0 (the License);
9#you may not use this software except in compliance with the License.
10#You may obtain a copy of the License at
11
12 # http://www.apache.org/licenses/LICENSE-2.0
13
14#Unless required by applicable law or agreed to in writing, software
15#distributed under the License is distributed on an "AS IS" BASIS,
16#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17#See the License for the specific language governing permissions and
18#limitations under the License.
19
20#ECOMP is a trademark and service mark of AT&T Intellectual Property.
21#============LICENSE_END============================================
22
23### STAGE 1: Build ###
24
25# We label our stage as 'builder'
26FROM node:8-alpine as builder
27
28COPY package.json .
29
30RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
31
32## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
33RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app
34
35WORKDIR /ng-app
36
37COPY . .
38
39## Build the angular app in production mode and store the artifacts in dist folder
40RUN $(npm bin)/ng build --env=prod
41
42
43### STAGE 2: Setup ###
44
45FROM nginx:1.13.3-alpine
46
47## Copy our default nginx config
48COPY nginx/default.conf /etc/nginx/conf.d/
49
50## Remove default nginx website
51RUN rm -rf /usr/share/nginx/html/*
52
53## From 'builder' stage copy over the artifacts in dist folder to default nginx public folder
54COPY --from=builder /ng-app/dist /usr/share/nginx/html
55
56CMD ["nginx", "-g", "daemon off;"]