File size: 961 Bytes
32bcc60
 
e01140c
 
 
a954bca
32bcc60
a954bca
 
e01140c
 
897621a
 
 
 
a954bca
e01140c
 
 
7d8e09f
32bcc60
a954bca
 
32bcc60
e01140c
 
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
# Dockerfile for the Backend API

# 1. Start with a stable and widely-used Python version.
# The 'bullseye' version is a specific release of Debian that has the libraries we need.
FROM python:3.10-slim-bullseye

# 2. Set the working directory inside the container.
WORKDIR /code

# 3. Update package lists and install the required system libraries for OpenCV.
# This single command installs all necessary dependencies in one go.
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# 4. Copy the requirements file and install Python dependencies.
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# 5. Copy all your application files (backend_app.py, best.pt) into the container.
COPY . /code/

# 6. The command that tells the server how to run your FastAPI app.
CMD ["uvicorn", "backend_app:app", "--host", "0.0.0.0", "--port", "7860"]