# Multi-stage Dockerfile for Thumbnail Crafter Space with MCP # Stage 1: Build the React frontend FROM node:18-slim as frontend-builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci # Copy source code COPY . . # Build the React app RUN npm run build # Stage 2: Python backend with FastAPI and Playwright FROM python:3.11 WORKDIR /app # Install system dependencies for Playwright RUN apt-get update && apt-get install -y \ libfreetype6-dev \ libjpeg-dev \ libpng-dev \ fonts-liberation \ wget \ gnupg \ && rm -rf /var/lib/apt/lists/* # Copy Python requirements COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Install Playwright and Chromium RUN playwright install chromium RUN playwright install-deps chromium # Copy FastAPI backend (use the comprehensive server with full API) COPY mcp_server_comprehensive.py main.py COPY tools_comprehensive.json tools.json # Copy built React frontend from previous stage COPY --from=frontend-builder /app/dist ./dist # Copy assets for the React app COPY public/assets ./public/assets # Expose port EXPOSE 7860 # Set environment variables ENV PORT=7860 ENV HOST=0.0.0.0 ENV APP_URL=http://localhost:7860 # Start the FastAPI server CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]