-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
36 lines (26 loc) · 1002 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
# Use the official Node.js 18 image as a base
FROM node:18.16.1-alpine
# Install bash for debugging purposes (optional)
RUN apk add --no-cache bash
# Install global Node.js packages for NestJS development
RUN npm i -g @nestjs/cli typescript ts-node
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Copy the Prisma configuration and migration files
# This line copies the "prisma" directory from your project's root into the Docker container's working directory.
COPY prisma ./prisma/
COPY env-example ./.env
# Install project dependencies
RUN npm install
# Copy the rest of the application code to the container
COPY . .
# Build your Nest.js application
RUN npm run build
# Expose the PORT environment variable (default to 4000 if not provided)
ARG PORT=4000
ENV PORT=$PORT
EXPOSE $PORT
# Start the Nest.js application using the start:prod script
CMD ["npm", "run", "start:prod"]