# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use an official Node.js runtime as a parent image
FROM node:18-alpine AS build
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . .
# Install any needed packages
RUN npm install
# Compile the TypeScript code
RUN npm run build
# Use a smaller Node.js runtime for the release build
FROM node:18-alpine AS release
# Set the working directory
WORKDIR /app
# Copy compiled files from the build image
COPY --from=build /app/build /app/build
# Copy necessary package.json files
COPY --from=build /app/package.json /app/package-lock.json /app/
# Install only production dependencies
RUN npm install --omit=dev --ignore-scripts
# Set executable permissions
RUN chmod +x build/index.js
# Set production environment
ENV NODE_ENV=production
# Set the user to non-root for security
USER node
# Run the server
ENTRYPOINT ["node", "build/index.js"]