# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Node.js image
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
# Install dependencies and build the project
RUN npm install --ignore-scripts && \
npm run build
# Copy the source code and tsconfig
COPY tsconfig.json tsconfig.json
COPY src/ src/
# Build the project
RUN npm run build
# Use a minimal image to run the app
FROM node:20-alpine
# Set working directory
WORKDIR /app
# Copy only the necessary files from the builder
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json
# Install only production dependencies
RUN npm install --omit=dev --ignore-scripts
# Define environment variables
ENV NODE_ENV=production
# Entry point for the container
ENTRYPOINT ["node", "dist/index.js"]