Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +23 -14
Dockerfile
CHANGED
|
@@ -1,20 +1,29 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
WORKDIR /
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
# Install
|
| 11 |
-
RUN
|
| 12 |
|
| 13 |
-
# Copy
|
| 14 |
-
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 1 |
+
# Use Python 3.10 for compatibility with newer packages
|
| 2 |
+
FROM python:3.10
|
| 3 |
|
| 4 |
+
# Set up a working directory
|
| 5 |
+
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Expose port 80
|
| 8 |
+
EXPOSE 80
|
| 9 |
|
| 10 |
+
# Install OpenCV and poppler-utils dependencies
|
| 11 |
+
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 poppler-utils
|
| 12 |
|
| 13 |
+
# Copy just the requirements file into the working directory
|
| 14 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 15 |
+
|
| 16 |
+
# Install dependencies from the requirements file
|
| 17 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 18 |
+
|
| 19 |
+
# Install PyTorch or TensorFlow
|
| 20 |
+
RUN pip install torch torchvision
|
| 21 |
|
| 22 |
+
# Set environment variable to indicate PyTorch usage
|
| 23 |
+
ENV USE_TORCH=1
|
| 24 |
+
|
| 25 |
+
# Copy the rest of the application code into the working directory
|
| 26 |
+
COPY . .
|
| 27 |
|
| 28 |
+
# Set the entry point to run the FastAPI app with uvicorn
|
| 29 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
|