Spaces:
Runtime error
Runtime error
File size: 985 Bytes
5e0b388 | 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 | # Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Create cache directories with proper permissions
RUN mkdir -p /tmp/transformers_cache /tmp/hf_home && \
chmod 777 /tmp/transformers_cache /tmp/hf_home
# Set environment variables for transformers cache
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
ENV HF_HOME=/tmp/hf_home
# Copy the requirements file and install dependencies first to leverage caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all of your project files from the repository into the container
COPY . .
# Tell Docker that the container listens on port 7860
# Hugging Face Spaces expects applications to run on this port
EXPOSE 7860
# --- CORRECTED COMMAND ---
# This correctly points to the 'app' variable inside the 'app/main.py' file
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|