-
Notifications
You must be signed in to change notification settings - Fork 32
/
Dockerfile
38 lines (26 loc) · 883 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
# Stage 1: Build the Angular application
FROM node:18-alpine AS build
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json first to leverage Docker caching
COPY viewer/package*.json ./viewer/
# Install dependencies
RUN cd viewer && npm ci
# Copy the rest of the application code
COPY . .
# Build the Angular application
RUN cd viewer && npm run build:ssr
# Stage 2: Serve the application using Node.js
FROM node:18-alpine
# Set the working directory
WORKDIR /app
# Copy the built application from the previous stage
COPY --from=build /app/viewer/dist /app/dist
# Copy package.json and package-lock.json for production dependencies
COPY viewer/package*.json ./
# Install only production dependencies
RUN npm install --only=production
# Expose the port the app runs on
EXPOSE 4000
# Start the application
CMD ["npm", "run", "serve:ssr:viewer"]