File size: 809 Bytes
ceaeaf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88cbd48
ceaeaf3
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
# Use an official Python runtime as a parent image
FROM python:3.9

# Create a non-root user for security
RUN useradd -m -u 1000 user
USER user

# Set the working directory in the container
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

# Copy the requirements file into the container
COPY --chown=user ./requirements.txt requirements.txt

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

# Copy the rest of the application code into the container
COPY --chown=user . .

# Command to run the application.
# Hugging Face Spaces expects the app to listen on port 7860.
# The command points to the `api_app` object inside the `api/main.py` file.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]