Files
flashcards-api/Dockerfile
2024-12-20 14:18:41 +01:00

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"]