# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
FROM node:lts-alpine AS builder

WORKDIR /app

# Copy package.json and package-lock.json if exists
COPY package.json ./

# Install dependencies without running scripts to avoid issues
RUN npm install --ignore-scripts

# Copy the rest of the files
COPY . ./

# Build the project
RUN npm run build


FROM node:lts-alpine

WORKDIR /app

# Copy only necessary files for runtime
COPY package.json ./
COPY --from=builder /app/dist ./dist

# Install only production dependencies
RUN npm install --production --ignore-scripts

EXPOSE 3000

# Run the server
CMD ["npm", "start"]