Spaces:
Build error
Build error
| # Base image with Python and Node | |
| FROM python:3.11-slim | |
| # Install system dependencies and Node.js for React build | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| curl \ | |
| nodejs npm \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy all project files (flattened structure in root) | |
| COPY package.json yarn.lock* ./ | |
| COPY requirements.txt ./ | |
| COPY App.js App.css index.js server.py ./ | |
| # Copy CRACO config | |
| COPY craco.config.js ./ | |
| COPY index.html ./ | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install Yarn globally and install Node dependencies | |
| RUN npm install -g yarn | |
| RUN yarn install --frozen-lockfile | |
| # Build React frontend | |
| RUN yarn build | |
| # Create .env.example | |
| RUN echo "OPENROUTER_API_KEY=your_openrouter_api_key_here" > .env.example && \ | |
| echo "SYSTEM_PROMPT=You are a helpful coding assistant that generates clean, well-structured code." >> .env.example && \ | |
| echo "PORT=7860" >> .env.example | |
| # Expose default Hugging Face Spaces port | |
| EXPOSE 7860 | |
| # Set environment variables | |
| ENV PYTHONPATH=. | |
| ENV PORT=7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:$PORT/api/health || exit 1 | |
| # Command to run the app | |
| CMD python -m uvicorn servey:app --host 0.0.0.0 --port $PORT | |