-
Notifications
You must be signed in to change notification settings - Fork 12
/
dockerfile
45 lines (30 loc) · 1.01 KB
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
##### Stage 1
FROM node:10.15.0 as builder
WORKDIR /app
# Copy project files to the docker image
COPY . .
# install angular/cli globally (latest version, change this to the version you are using)
RUN yarn global add @angular/cli@latest
# if you prefer npm, replace the above command with
# RUN npm install @angular/cli@latest -g
# install packages
RUN yarn install
# FOR NPM
# npm install
# SET ENVIRONMENT VARIABLES
ENV ENVIRONMENT=production1
ENV SomeAPIKey="This is not an API Key"
ENV SomeOtherAPIKey="This is not another API Key"
# Build Angular Application in Production
RUN ng build --prod
#### STAGE 2
#### Deploying the application
FROM nginx:alpine
VOLUME /var/cache/nginx
# Copy the build files from the project
# replace "angular-docker-environment-variables" with your angular project name
COPY --from=builder /app/dist/angular-docker-environment-variables /usr/share/nginx/html
# Copy Nginx Files
COPY --from=builder /app/.docker/.config/nginx.conf /etc/nginx/conf.d/default.conf
# EXPOSE Port 80
EXPOSE 80