Upload docker/Dockerfile with huggingface_hub
Browse files- docker/Dockerfile +83 -0
docker/Dockerfile
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.8.1-devel-ubuntu22.04
|
| 2 |
+
|
| 3 |
+
LABEL authors="jaret"
|
| 4 |
+
|
| 5 |
+
# Set noninteractive to avoid timezone prompts
|
| 6 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 7 |
+
|
| 8 |
+
# ref https://en.wikipedia.org/wiki/CUDA
|
| 9 |
+
ENV TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0 10.0 12.0"
|
| 10 |
+
|
| 11 |
+
# Install dependencies
|
| 12 |
+
RUN apt-get update && apt-get install --no-install-recommends -y \
|
| 13 |
+
git \
|
| 14 |
+
curl \
|
| 15 |
+
build-essential \
|
| 16 |
+
cmake \
|
| 17 |
+
wget \
|
| 18 |
+
python3.10 \
|
| 19 |
+
python3-pip \
|
| 20 |
+
python3-dev \
|
| 21 |
+
python3-setuptools \
|
| 22 |
+
python3-wheel \
|
| 23 |
+
python3-venv \
|
| 24 |
+
ffmpeg \
|
| 25 |
+
tmux \
|
| 26 |
+
htop \
|
| 27 |
+
nvtop \
|
| 28 |
+
python3-opencv \
|
| 29 |
+
openssh-client \
|
| 30 |
+
openssh-server \
|
| 31 |
+
openssl \
|
| 32 |
+
rsync \
|
| 33 |
+
unzip \
|
| 34 |
+
&& apt-get clean \
|
| 35 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 36 |
+
|
| 37 |
+
# Install nodejs
|
| 38 |
+
WORKDIR /tmp
|
| 39 |
+
RUN curl -sL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh && \
|
| 40 |
+
bash nodesource_setup.sh && \
|
| 41 |
+
apt-get update && \
|
| 42 |
+
apt-get install -y nodejs && \
|
| 43 |
+
apt-get clean && \
|
| 44 |
+
rm -rf /var/lib/apt/lists/*
|
| 45 |
+
|
| 46 |
+
WORKDIR /app
|
| 47 |
+
|
| 48 |
+
# Set aliases for python and pip
|
| 49 |
+
RUN ln -s /usr/bin/python3 /usr/bin/python
|
| 50 |
+
|
| 51 |
+
# install pytorch before cache bust to avoid redownloading pytorch
|
| 52 |
+
RUN pip install --pre --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
|
| 53 |
+
|
| 54 |
+
# Fix cache busting by moving CACHEBUST to right before git clone
|
| 55 |
+
ARG CACHEBUST=1234
|
| 56 |
+
ARG GIT_COMMIT=main
|
| 57 |
+
RUN echo "Cache bust: ${CACHEBUST}" && \
|
| 58 |
+
git clone https://github.com/ostris/ai-toolkit.git && \
|
| 59 |
+
cd ai-toolkit && \
|
| 60 |
+
git checkout ${GIT_COMMIT}
|
| 61 |
+
|
| 62 |
+
WORKDIR /app/ai-toolkit
|
| 63 |
+
|
| 64 |
+
# Install Python dependencies
|
| 65 |
+
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 66 |
+
pip install --pre --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 --force && \
|
| 67 |
+
pip install setuptools==69.5.1 --no-cache-dir
|
| 68 |
+
|
| 69 |
+
# Build UI
|
| 70 |
+
WORKDIR /app/ai-toolkit/ui
|
| 71 |
+
RUN npm install && \
|
| 72 |
+
npm run build && \
|
| 73 |
+
npm run update_db
|
| 74 |
+
|
| 75 |
+
# Expose port (assuming the application runs on port 3000)
|
| 76 |
+
EXPOSE 8675
|
| 77 |
+
|
| 78 |
+
WORKDIR /
|
| 79 |
+
|
| 80 |
+
COPY docker/start.sh /start.sh
|
| 81 |
+
RUN chmod +x /start.sh
|
| 82 |
+
|
| 83 |
+
CMD ["/start.sh"]
|