Spaces:
Build error
Build error
File size: 1,298 Bytes
25df3e5 282b6f3 25df3e5 282b6f3 25df3e5 282b6f3 25df3e5 021c95c d8b1208 c2275d1 282b6f3 29c6710 282b6f3 25df3e5 282b6f3 25df3e5 29c6710 282b6f3 25df3e5 282b6f3 25df3e5 282b6f3 25df3e5 282b6f3 25df3e5 282b6f3 25df3e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # 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
|