Update Dockerfile
Browse files- Dockerfile +8 -30
Dockerfile
CHANGED
|
@@ -1,17 +1,11 @@
|
|
| 1 |
-
# -------------------------------
|
| 2 |
# Base image
|
| 3 |
-
# -------------------------------
|
| 4 |
FROM python:3.11-slim
|
| 5 |
|
| 6 |
-
# -------------------------------
|
| 7 |
# CPU-only environment
|
| 8 |
-
# -------------------------------
|
| 9 |
ENV TORCH_CUDA_ARCH_LIST=""
|
| 10 |
ENV CUDA_VISIBLE_DEVICES=""
|
| 11 |
|
| 12 |
-
# -------------------------------
|
| 13 |
# System dependencies
|
| 14 |
-
# -------------------------------
|
| 15 |
RUN apt-get update && apt-get install -y \
|
| 16 |
git \
|
| 17 |
ffmpeg \
|
|
@@ -22,33 +16,23 @@ RUN apt-get update && apt-get install -y \
|
|
| 22 |
libxrender-dev \
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
| 25 |
-
# -------------------------------
|
| 26 |
# Working directory
|
| 27 |
-
# -------------------------------
|
| 28 |
WORKDIR /app
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
# Copy requirements.txt
|
| 32 |
-
# -------------------------------
|
| 33 |
COPY requirements.txt .
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
# Install CPU PyTorch first
|
| 37 |
-
# -------------------------------
|
| 38 |
RUN pip install --no-cache-dir \
|
| 39 |
torch==2.1.0 \
|
| 40 |
torchvision==0.16.0 \
|
| 41 |
torchaudio==2.1.0 \
|
| 42 |
--index-url https://download.pytorch.org/whl/cpu
|
| 43 |
|
| 44 |
-
#
|
| 45 |
-
# Install compatible huggingface-hub first
|
| 46 |
-
# -------------------------------
|
| 47 |
RUN pip install --no-cache-dir huggingface-hub>=0.19.3
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
# Install remaining Python packages
|
| 51 |
-
# -------------------------------
|
| 52 |
RUN pip install --no-cache-dir \
|
| 53 |
git+https://github.com/ultralytics/ultralytics.git@main \
|
| 54 |
transformers>=4.35.0 \
|
|
@@ -56,17 +40,11 @@ RUN pip install --no-cache-dir \
|
|
| 56 |
gradio>=4.41.0 \
|
| 57 |
opencv-python-headless
|
| 58 |
|
| 59 |
-
#
|
| 60 |
-
|
| 61 |
-
# -------------------------------
|
| 62 |
-
# COPY . .
|
| 63 |
|
| 64 |
-
# -------------------------------
|
| 65 |
# Expose Gradio port
|
| 66 |
-
# -------------------------------
|
| 67 |
EXPOSE 7860
|
| 68 |
|
| 69 |
-
#
|
| 70 |
-
|
| 71 |
-
# -------------------------------
|
| 72 |
-
CMD ["bash"]
|
|
|
|
|
|
|
| 1 |
# Base image
|
|
|
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
|
|
|
| 4 |
# CPU-only environment
|
|
|
|
| 5 |
ENV TORCH_CUDA_ARCH_LIST=""
|
| 6 |
ENV CUDA_VISIBLE_DEVICES=""
|
| 7 |
|
|
|
|
| 8 |
# System dependencies
|
|
|
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
git \
|
| 11 |
ffmpeg \
|
|
|
|
| 16 |
libxrender-dev \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
|
|
|
| 19 |
# Working directory
|
|
|
|
| 20 |
WORKDIR /app
|
| 21 |
|
| 22 |
+
# Copy requirements
|
|
|
|
|
|
|
| 23 |
COPY requirements.txt .
|
| 24 |
|
| 25 |
+
# Install CPU PyTorch
|
|
|
|
|
|
|
| 26 |
RUN pip install --no-cache-dir \
|
| 27 |
torch==2.1.0 \
|
| 28 |
torchvision==0.16.0 \
|
| 29 |
torchaudio==2.1.0 \
|
| 30 |
--index-url https://download.pytorch.org/whl/cpu
|
| 31 |
|
| 32 |
+
# Install compatible huggingface-hub
|
|
|
|
|
|
|
| 33 |
RUN pip install --no-cache-dir huggingface-hub>=0.19.3
|
| 34 |
|
| 35 |
+
# Install remaining packages
|
|
|
|
|
|
|
| 36 |
RUN pip install --no-cache-dir \
|
| 37 |
git+https://github.com/ultralytics/ultralytics.git@main \
|
| 38 |
transformers>=4.35.0 \
|
|
|
|
| 40 |
gradio>=4.41.0 \
|
| 41 |
opencv-python-headless
|
| 42 |
|
| 43 |
+
# Copy app code
|
| 44 |
+
COPY app.py .
|
|
|
|
|
|
|
| 45 |
|
|
|
|
| 46 |
# Expose Gradio port
|
|
|
|
| 47 |
EXPOSE 7860
|
| 48 |
|
| 49 |
+
# Run the app
|
| 50 |
+
CMD ["python", "app.py"]
|
|
|
|
|
|