2024-10-09 19:44:34 +08:00
|
|
|
# Use the official Node.js image
|
|
|
|
FROM node:lts-slim
|
|
|
|
|
|
|
|
# Set the working directory in the container
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy package.json and pnpm-lock.yaml for installing dependencies
|
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
|
|
|
|
# Install pnpm
|
|
|
|
RUN npm install -g pnpm
|
|
|
|
|
|
|
|
# Install project dependencies
|
2024-10-13 01:38:52 +08:00
|
|
|
RUN pnpm install --frozen-lockfile
|
2024-10-09 19:44:34 +08:00
|
|
|
|
|
|
|
# Copy the rest of the application code
|
|
|
|
COPY . .
|
|
|
|
|
2024-10-13 01:38:52 +08:00
|
|
|
# Build the application for production
|
|
|
|
RUN pnpm run build
|
|
|
|
|
2024-10-09 19:44:34 +08:00
|
|
|
# Expose the port
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2024-10-13 01:38:52 +08:00
|
|
|
# Command to run the application in production
|
|
|
|
CMD ["pnpm", "run", "start"]
|