# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Node.js image for building the server
FROM node:18-alpine AS builder

# Set the working directory in the container
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 entire source code into the working directory
COPY . .

# Build the TypeScript files
RUN npm run build

# Use a smaller Node.js image for the runtime
FROM node:18-slim

# Set the working directory in the runtime image
WORKDIR /app

# Copy the build files from the builder image
COPY --from=builder /app/build ./build

# Copy package.json and package-lock.json for production install
COPY package.json package-lock.json ./

# Install only production dependencies
RUN npm install --omit=dev

# Set environment variables for Twitter API
ENV API_KEY=your_api_key_here
ENV API_SECRET_KEY=your_api_secret_key_here
ENV ACCESS_TOKEN=your_access_token_here
ENV ACCESS_TOKEN_SECRET=your_access_token_secret_here

# Start the server
CMD ["node", "build/index.js"]