File size: 769 Bytes
7c6d7d8
 
8377b76
cea93f2
 
 
 
0b86be7
be7b5eb
0b86be7
be7b5eb
0b86be7
 
 
cea93f2
7c6d7d8
0b86be7
 
 
8377b76
7c6d7d8
be7b5eb
7c6d7d8
cea93f2
7c6d7d8
8377b76
7c6d7d8
 
 
cea93f2
43b9e82
 
cea93f2
43b9e82
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
35
# Use Python 3.10 for compatibility with newer packages
FROM python:3.10

# Install required system dependencies
RUN apt-get update && apt-get install -y \
    libgl1-mesa-glx \
    libglib2.0-0

RUN useradd user

USER user

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

# Set up a working directory
WORKDIR $HOME/app

COPY --chown=user ./ $HOME/app

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

# Install PyTorch and torchvision
RUN pip install torch torchvision

# Set environment variable to indicate PyTorch usage
ENV USE_TORCH=1 

# Expose port 7860 for the app
EXPOSE 7860

# Command to run FastAPI app with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]