File size: 987 Bytes
7c6d7d8
 
8377b76
0b86be7
 
 
 
 
 
 
 
7c6d7d8
0b86be7
 
 
8377b76
7c6d7d8
 
8377b76
7c6d7d8
 
8377b76
7c6d7d8
 
 
 
 
 
 
 
8377b76
7c6d7d8
 
 
 
 
8377b76
7c6d7d8
 
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
36
37
38
39
40
# Use Python 3.10 for compatibility with newer packages
FROM python:3.10


RUN useradd admin

USER admin

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
    
# Set up a working directory
WORKDIR $HOME/app

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

# Expose port 80
EXPOSE 80

# Install OpenCV and poppler-utils dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 poppler-utils

# Copy just the requirements file into the working directory
COPY ./requirements.txt /code/requirements.txt

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

# Install PyTorch or TensorFlow
RUN pip install torch torchvision

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

# Copy the rest of the application code into the working directory
COPY . .

# Set the entry point to run the FastAPI app with uvicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]