# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Stage 1: Build the application
FROM node:18-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the TypeScript files
RUN npm run build
# Stage 2: Run the application
FROM node:18-alpine
# Set the working directory
WORKDIR /app
# Copy the build output from the builder stage
COPY --from=builder /app/build ./build
# Copy the package.json and package-lock.json
COPY --from=builder /app/package.json /app/package-lock.json ./
# Install husky
RUN npm install -g husky
# Install only production dependencies
RUN npm install --omit=dev
# Copy the .env.example file to .env if .env doesn't exist (For demonstration purposes, in real use case, .env should be provided at runtime)
RUN cp .env.example .env || true
# Expose the application port
EXPOSE 3000
# Start the application
CMD ["node", "build/index.js"]