forked from revathivinodkumar/Angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (20 loc) · 749 Bytes
/
Copy pathDockerfile
File metadata and controls
30 lines (20 loc) · 749 Bytes
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
# Stage 1: Compile and Build angular codebase
# Use official node image as the base image
FROM node:16 as build
# Set the working directory
WORKDIR /usr/local/app
# Add the source code to app
COPY ./ /usr/local/app/
RUN export NODE_OPTIONS=--openssl-legacy-provider
# Install all the dependencies
RUN npm install
# Generate the build of the application
RUN node_modules/.bin/ng build --output-path=dist
# Stage 2: Serve app with nginx server
# Use official nginx image as the base image
FROM nginx:latest
WORKDIR /usr/local/app
# Copy the build output to replace the default nginx contents
COPY --from=build /usr/local/app /usr/local/app
COPY --from=build /usr/local/app/dist /usr/share/nginx/html
EXPOSE 80