File size: 763 Bytes
ffaeec5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
# Use a Python 3.9 base image
FROM python:3.9-slim

# Set working directory
WORKDIR /code

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

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

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

# Set up directories and permissions
RUN mkdir -p /code/Data/Processed_Data && chown -R user:user /code

USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set app directory
WORKDIR /code

# Copy all project files with correct ownership
COPY --chown=user . /code

# Expose port 7860 (Hugging Face default)
EXPOSE 7860

# Run the FastAPI app with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]