-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
41 lines (28 loc) · 1021 Bytes
/
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
###############################################################################
# Stage 1: Compile and Build angular codebase
# Use official node image as the base image
FROM node:20 as build
# Set the working directory
WORKDIR /usr/local/app
# Add the source code to app
COPY ./ /usr/local/app/
# Update web build number.
RUN commit=$(git rev-parse --short HEAD) && sed -i -e "s/buildx/$commit/g" src/environments/environment.ts
# Install all the dependencies
RUN npm install --force
# Generate the build of the application
RUN npm run build
###############################################################################
# Stage 2: Serve dynamic app with node server (SSR).
# Use official node server.
FROM node:20 AS ssr-server
# Set the working directory.
WORKDIR /usr/local/app
# Copy dist files.
COPY --from=build /usr/local/app/dist /usr/local/app/dist/
# Copy packages json file.
COPY ./package.json /usr/local/app/package.json
# Expose port 8080
EXPOSE 8080
# Run HTTP server.
CMD npm run serve:ssr