File size: 1,040 Bytes
499d6a4
 
422b71e
499d6a4
 
29fc161
c0cabc5
466c6c0
 
 
499d6a4
 
43df7a4
499d6a4
 
29fc161
c0cabc5
499d6a4
29fc161
c0cabc5
 
 
 
 
499d6a4
422b71e
29fc161
499d6a4
ff4685d
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.10-slim

# Set the working directory in the container
WORKDIR /code

# Set a writable cache directory for Hugging Face models
ENV HF_HOME=/code/huggingface_cache
ENV TRANSFORMERS_CACHE=/code/huggingface_cache

# Copy the requirements file into the container at /code
COPY ./requirements.txt /code/requirements.txt

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the rest of the application code into the container at /code
COPY . /code/

# --- FIX: Change ownership of the app directory ---
# The container runs as a non-root user (UID 1000) who needs permission to write to the cache.
# This command gives that user ownership of the /code directory.
RUN chown -R 1000:1000 /code

# Expose the port the app will run on. Hugging Face Spaces uses 7860 by default.
EXPOSE 7860

# Command to run the application using uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]