File size: 610 Bytes
761a6fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Use the official Python image
FROM python:3.9

# Set the working directory
WORKDIR /code

# Copy the requirements file
COPY ./requirements.txt /code/requirements.txt

# Install the dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the application code
COPY ./app.py /code/app.py

# Create a writable cache directory (FastAPI/Uvicorn needs this sometimes)
RUN mkdir -p /code/cache
RUN chmod 777 /code/cache
ENV XDG_CACHE_HOME=/code/cache

# Start the application on port 7860 (Hugging Face's default port)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]