File size: 935 Bytes
e966654
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use a Python base image
FROM python:3.10-slim

# Set the working directory
WORKDIR /app

# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# --- IMPORTANT: Configure Caching to /tmp ---
# Spaces only allow writing to /tmp, which is critical for many ML libraries.
# Although not strictly required for google-genai, it is a best practice.
ENV XDG_CACHE_HOME=/tmp/hf_cache
ENV HF_HOME=/tmp/hf_cache

# Copy your application code
# This copies main.py, snake_rec.py, and your .env (if you want to use it
# but using HF Secrets is much better, see Step 3)
COPY . .

# Expose the required port (7860 is the default for HF Spaces)
EXPOSE 7860

# The command to run your FastAPI application using uvicorn
# 'main:app' refers to the 'app' object in 'main.py'
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]