# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use an official Node.js image as a base
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
RUN --mount=type=cache,target=/root/.npm npm install
# Copy the source code
COPY src ./src
COPY tsconfig.json ./
# Build the application
RUN npm run build
# Use a smaller Node.js runtime image
FROM node:20-alpine
# Set working directory
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
# Install only production dependencies
RUN npm install --omit=dev
# Set environment variables (can be overridden when running the container)
ENV BETTER_AUTH_PROJECT_ID="your-project-id" \
BETTER_AUTH_API_KEY="your-api-key"
# Expose the necessary port (if applicable)
EXPOSE 3000
# Command to run the application
ENTRYPOINT ["node", "build/index.js"]