add dockerfile and github actions workflow for deploy

This commit is contained in:
2024-04-13 13:01:49 +02:00
parent 616626b4ce
commit 82484be19c
4 changed files with 109 additions and 0 deletions

31
Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
# Use the official Node.js LTS as a parent image
FROM node:lts-alpine
# 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"]