# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Node.js Alpine image as the base
FROM node:22-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy the package.json and package-lock.json if present
COPY package.json /app/
COPY pnpm-lock.yaml /app/
# Install the dependencies
RUN --mount=type=cache,target=/root/.npm npm install --ignore-scripts
# Copy the rest of the application code
COPY . /app
# Build the application
RUN npm run build
# Use a new, clean image for the release
FROM node:22-alpine
# Set the working directory
WORKDIR /app
# Copy the built 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
# Set environment variables
ENV MYSQL_HOST=127.0.0.1
ENV MYSQL_PORT=3306
ENV MYSQL_USER=root
ENV MYSQL_PASS=
ENV MYSQL_DB=db_name
# Install production dependencies only
RUN npm ci --omit=dev
# Expose any ports if necessary (e.g., 8080)
# EXPOSE 8080
# Run the server
ENTRYPOINT ["node", "dist/index.js"]