-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 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
# Stage 1: Build Stage
FROM node:18-alpine AS build
# Set the working directory in the container
WORKDIR /app
# Copy package.json and yarn.lock to the container
COPY package.json yarn.lock ./
# Install project dependencies
RUN yarn install --frozen-lockfile
# Copy the rest of the application code to the container
COPY . .
# Build the Nest.js application
RUN NODE_OPTIONS=--max-old-space-size=8192 yarn build
# Stage 2: Production Stage
FROM node:18-alpine AS production
# Set the working directory in the container
WORKDIR /app
# Copy only the necessary files from the build stage
COPY --from=build /app/dist ./dist
COPY package.json yarn.lock ./
# Install only production dependencies
RUN yarn install --frozen-lockfile --production
# Expose the ports that the Nest.js app will run on
EXPOSE 3000
EXPOSE 50051
# Start the Nest.js application
CMD ["yarn", "start:prod"]