Update Dockerfile
Browse files- Dockerfile +16 -33
Dockerfile
CHANGED
|
@@ -1,26 +1,9 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
-
|
| 4 |
-
# Set up Python 3.11
|
| 5 |
-
RUN apt-get update && \
|
| 6 |
-
apt-get install -y --no-install-recommends \
|
| 7 |
-
python3.11 \
|
| 8 |
-
python3.11-dev \
|
| 9 |
-
python3-pip \
|
| 10 |
-
python3.11-venv \
|
| 11 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
-
|
| 13 |
-
# Make Python 3.11 the default
|
| 14 |
-
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
| 15 |
|
| 16 |
# Install system dependencies
|
| 17 |
RUN apt-get update && \
|
| 18 |
apt-get install -y --no-install-recommends \
|
| 19 |
-
git \
|
| 20 |
-
build-essential \
|
| 21 |
-
cmake \
|
| 22 |
-
libopenmpi-dev \
|
| 23 |
-
openmpi-bin \
|
| 24 |
unrar \
|
| 25 |
libgl1 \
|
| 26 |
libglib2.0-0 \
|
|
@@ -28,25 +11,25 @@ RUN apt-get update && \
|
|
| 28 |
|
| 29 |
WORKDIR /app
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
RUN
|
| 33 |
-
RUN pip install --no-cache-dir "numpy<2"
|
| 34 |
|
| 35 |
-
# Install PyTorch
|
| 36 |
RUN pip install --no-cache-dir \
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
# Install flash-attn with compatible version
|
| 43 |
-
RUN pip install --no-cache-dir flash-attn==2.3.3 --no-build-isolation
|
| 44 |
|
| 45 |
-
#
|
| 46 |
COPY requirements.txt .
|
| 47 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 48 |
|
| 49 |
-
#
|
|
|
|
|
|
|
|
|
|
| 50 |
COPY . .
|
| 51 |
|
| 52 |
# Create non-root user
|
|
@@ -55,7 +38,7 @@ RUN useradd -m -u 1000 user && \
|
|
| 55 |
|
| 56 |
USER user
|
| 57 |
|
| 58 |
-
#
|
| 59 |
ENV HF_HUB_DISABLE_PROGRESS=1
|
| 60 |
ENV TF_CPP_MIN_LOG_LEVEL=3
|
| 61 |
|
|
|
|
| 1 |
+
# Use official Python image
|
| 2 |
+
FROM python:3.11-slim-bullseye
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Install system dependencies
|
| 5 |
RUN apt-get update && \
|
| 6 |
apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
unrar \
|
| 8 |
libgl1 \
|
| 9 |
libglib2.0-0 \
|
|
|
|
| 11 |
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Install Python dependencies in optimal order
|
| 15 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
|
|
|
| 16 |
|
| 17 |
+
# Install CPU-only PyTorch and compatible NumPy first
|
| 18 |
RUN pip install --no-cache-dir \
|
| 19 |
+
"numpy<2" \
|
| 20 |
+
torch==2.1.2+cpu \
|
| 21 |
+
torchvision==0.16.2+cpu \
|
| 22 |
+
torchaudio==2.1.2+cpu \
|
| 23 |
+
--index-url https://download.pytorch.org/whl/cpu
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
# Install other requirements
|
| 26 |
COPY requirements.txt .
|
| 27 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
| 29 |
+
# Remove flash-attn if not needed (GPU-only package)
|
| 30 |
+
RUN pip uninstall -y flash-attn || true
|
| 31 |
+
|
| 32 |
+
# Copy application code
|
| 33 |
COPY . .
|
| 34 |
|
| 35 |
# Create non-root user
|
|
|
|
| 38 |
|
| 39 |
USER user
|
| 40 |
|
| 41 |
+
# Environment variables to suppress warnings
|
| 42 |
ENV HF_HUB_DISABLE_PROGRESS=1
|
| 43 |
ENV TF_CPP_MIN_LOG_LEVEL=3
|
| 44 |
|