mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-16 20:59:26 +00:00
32 lines
721 B
Docker
32 lines
721 B
Docker
# Use the official Node.js LTS as a parent image
|
|
FROM node:20-alpine
|
|
RUN apk add --no-cache openssl
|
|
# Set the working directory in the Docker container
|
|
WORKDIR /usr/src/app
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm
|
|
|
|
# Copy package.json, pnpm-lock.yaml (or package-lock.json if you use it) to the Docker container
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy the rest of your application's code into the Docker container
|
|
COPY . .
|
|
|
|
# Generate Prisma client
|
|
RUN npx prisma generate
|
|
|
|
# Build your NestJS application
|
|
RUN pnpm run build
|
|
|
|
ENV PORT 3333
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 3333
|
|
|
|
# Command to run when starting the container
|
|
CMD ["node", "dist/main"]
|