# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use the official Node.js 18 image as the base image
FROM node:18-alpine AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install dependencies (ignoring scripts to prevent premature build)
RUN npm install --ignore-scripts
# Copy the rest of the application code to the container
COPY . .
# Build the TypeScript files
RUN npm run build
# Final stage: Use a smaller Node.js image to run the application
FROM node:18-alpine
# Set the working directory inside the container
WORKDIR /app
# Copy built files from the builder stage
COPY --from=builder /app/build /app/build
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json
# Install production dependencies only
RUN npm install --omit=dev --ignore-scripts
# Command to run the application
ENTRYPOINT ["node", "build/index.js"]