Spaces:
Sleeping
Sleeping
dekh le bro
Browse files- Dockerfile +10 -13
Dockerfile
CHANGED
|
@@ -1,29 +1,26 @@
|
|
| 1 |
# Dockerfile for the Backend API
|
| 2 |
|
| 3 |
-
# 1. Start with a
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
# 2. Set the working directory inside the container.
|
| 7 |
WORKDIR /code
|
| 8 |
|
| 9 |
-
# 3.
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
# 4. Copy the requirements file and install Python dependencies.
|
| 13 |
-
COPY ./requirements.txt /code/requirements.txt
|
| 14 |
RUN apt-get update && apt-get install -y \
|
| 15 |
libgl1 \
|
| 16 |
libglib2.0-0 \
|
| 17 |
-
libsm6 \
|
| 18 |
-
libxext6 \
|
| 19 |
-
libxrender1 \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
# 5. Copy all your application files (backend_app.py, best.pt) into the container.
|
| 26 |
COPY . /code/
|
| 27 |
|
| 28 |
# 6. The command that tells the server how to run your FastAPI app.
|
| 29 |
-
CMD ["uvicorn", "backend_app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
| 1 |
# Dockerfile for the Backend API
|
| 2 |
|
| 3 |
+
# 1. Start with a stable and widely-used Python version.
|
| 4 |
+
# The 'bullseye' version is a specific release of Debian that has the libraries we need.
|
| 5 |
+
FROM python:3.10-slim-bullseye
|
| 6 |
|
| 7 |
# 2. Set the working directory inside the container.
|
| 8 |
WORKDIR /code
|
| 9 |
|
| 10 |
+
# 3. Update package lists and install the required system libraries for OpenCV.
|
| 11 |
+
# This single command installs all necessary dependencies in one go.
|
|
|
|
|
|
|
|
|
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
libgl1 \
|
| 14 |
libglib2.0-0 \
|
|
|
|
|
|
|
|
|
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
+
# 4. Copy the requirements file and install Python dependencies.
|
| 18 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 19 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 20 |
|
| 21 |
# 5. Copy all your application files (backend_app.py, best.pt) into the container.
|
| 22 |
COPY . /code/
|
| 23 |
|
| 24 |
# 6. The command that tells the server how to run your FastAPI app.
|
| 25 |
+
CMD ["uvicorn", "backend_app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 26 |
+
|