File size: 1,138 Bytes
8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e badf26d 8308b9e 3720aac badf26d 3720aac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# Base image with CUDA support
FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu22.04 AS model-downloader
WORKDIR /app
# Install only essential system dependencies in a single RUN to reduce layers
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-dev \
git \
ffmpeg \
curl \
build-essential \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Rust in a single command and clean up
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal \
&& rm -rf /root/.rustup/toolchains/*/share/doc
ENV PATH="/root/.cargo/bin:${PATH}"
ENV CC=/usr/bin/gcc
ENV CXX=/usr/bin/g++
# Upgrade pip and install Python dependencies in one layer
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools setuptools-rust torch && \
pip install --no-cache-dir flash-attn --no-build-isolation && \
pip install --no-cache-dir -r requirements.txt
# Set up user
RUN useradd -ms /bin/bash appuser && chown -R appuser:appuser /app
USER appuser |