# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use an official Node.js runtime as a parent image for the build
FROM node:22.12-alpine AS builder
# Set the working directory in the container
WORKDIR /app
# Copy the package.json and package-lock.json into the container
COPY package.json package-lock.json ./
# Install dependencies, skipping the `prepare` step to avoid running build scripts
RUN npm install --ignore-scripts
# Copy the source code into the container
COPY src ./src
# Build the project using the specified build command in the package.json
RUN npm run build
# Use a smaller base image for the runtime
FROM node:22.12-alpine AS runner
# Set the working directory in the container
WORKDIR /app
# Copy the build artifacts from the builder stage
COPY --from=builder /app/dist ./dist
# Copy the necessary node modules
COPY --from=builder /app/node_modules ./node_modules
# Define environment variable
ENV NODE_ENV=production
# Define the command to run the application
ENTRYPOINT ["node", "dist/index.cjs"]