Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +11 -13
Dockerfile
CHANGED
|
@@ -1,30 +1,28 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
# Set up the environment
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
|
| 8 |
-
# Install
|
| 9 |
-
RUN apt-get update && apt-get install -y
|
| 10 |
-
python3.10 python3-pip \
|
| 11 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Set the working directory
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
-
# Set a writable cache directory
|
| 17 |
ENV HF_HOME=/app/cache
|
| 18 |
|
| 19 |
-
# Create the cache directory
|
| 20 |
RUN mkdir -p /app/cache && chmod 777 /app/cache
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
RUN
|
| 24 |
|
| 25 |
# Copy and install the rest of the Python dependencies
|
| 26 |
COPY requirements.txt .
|
| 27 |
-
RUN
|
| 28 |
|
| 29 |
# Copy your main application code
|
| 30 |
COPY main.py .
|
|
@@ -32,5 +30,5 @@ COPY main.py .
|
|
| 32 |
# Expose the port your API will run on
|
| 33 |
EXPOSE 8000
|
| 34 |
|
| 35 |
-
# The command to start the Uvicorn server
|
| 36 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
+
# Start from a standard Python 3.10 image
|
| 2 |
+
FROM python:3.10-slim-buster
|
| 3 |
|
| 4 |
# Set up the environment
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
|
| 8 |
+
# Install system dependencies needed for OpenCV
|
| 9 |
+
RUN apt-get update && apt-get install -y libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Set the working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Set a writable cache directory
|
| 15 |
ENV HF_HOME=/app/cache
|
| 16 |
|
| 17 |
+
# Create the cache directory
|
| 18 |
RUN mkdir -p /app/cache && chmod 777 /app/cache
|
| 19 |
|
| 20 |
+
# Install PyTorch for CUDA 11.3. It will link to the host's CUDA libraries at runtime.
|
| 21 |
+
RUN pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
|
| 22 |
|
| 23 |
# Copy and install the rest of the Python dependencies
|
| 24 |
COPY requirements.txt .
|
| 25 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
# Copy your main application code
|
| 28 |
COPY main.py .
|
|
|
|
| 30 |
# Expose the port your API will run on
|
| 31 |
EXPOSE 8000
|
| 32 |
|
| 33 |
+
# The command to start the Uvicorn server
|
| 34 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|