# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Node.js base image
FROM node:20-alpine AS builder

# Set the working directory
WORKDIR /app

# Copy package files
COPY package.json package-lock.json ./

# Copy the source files and tsconfig BEFORE npm install
COPY src ./src
COPY tsconfig.json ./

# Install dependencies
RUN npm install

# Compile TypeScript to JavaScript
RUN npm run build

# Use a smaller image for the runtime
FROM node:20-alpine AS runtime

LABEL org.opencontainers.image.source=https://github.com/taazkareem/clickup-mcp-server

# Set the working directory
WORKDIR /app

# Copy the build output and node_modules from the builder stage
COPY --from=builder /app/build ./build
COPY --from=builder /app/node_modules ./node_modules

# Copy the entrypoint script if necessary
COPY --from=builder /app/package.json ./

# Copy static assets
COPY public ./public

# Expose the desired port (if the server binds to a port)
EXPOSE 8080

# Set default environment variables for hosted deployment
ENV ENABLE_SSE=true
ENV HOST=0.0.0.0
ENV PORT=8080

# Define the command to run the application
CMD ["node", "build/index.js"]
