# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use Node.js 18 alpine image for a lightweight build
FROM node:18-alpine AS builder
# Set the working directory
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy package.json and pnpm-lock.yaml to leverage Docker cache
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install
# Copy the entire project
COPY . .
# Build the project
RUN pnpm build
# Use a clean Node.js image to run the app
FROM node:18-alpine AS release
# Set the working directory
WORKDIR /app
# Copy only the built files from the builder stage
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/pnpm-lock.yaml /app/
# Install only production dependencies
RUN pnpm install --prod
# Set the entrypoint to the built application
ENTRYPOINT ["node", "dist/index.js"]