tcuongtran / codepad

0 stars 0 forks source link

Dockerfile for deploying NodeJS on Render.com #2

Open tcuongtran opened 3 months ago

tcuongtran commented 3 months ago
# Use the official Node.js 20 image as the base image
FROM node:20-alpine

# Set the working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code to the working directory
COPY . .

# Build NestJs
RUN npm run build

# Expose the port that your NestJS application will run on
EXPOSE 3000

# Command to run your NestJS application using npm
CMD ["npm", "run", "start:prod"]