Skip to content

Commit

Permalink
feat: less docker layer && opt image size (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohrusky authored Jan 31, 2025
1 parent 2765de6 commit 0c6d709
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DEFAULT_GOAL := default

version := v0.2.0
VS_FFMPEG_DOCKER_VERSION := v0.0.2
VS_FFMPEG_DOCKER_VERSION := dev

.PHONY: lint ## pip install pre-commit
lint:
Expand Down
103 changes: 56 additions & 47 deletions vs-pytorch-rocm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,46 @@ RUN apt install -y \
&& add-apt-repository universe \
&& apt update

RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb
RUN apt install -y ./libtinfo5_6.2-0ubuntu2.1_amd64.deb && rm -f ./libtinfo5_6.2-0ubuntu2.1_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb
RUN apt install -y ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb && rm -f ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/s/suitesparse/libccolamd2_5.10.1+dfsg-4build1_amd64.deb
RUN apt install -y ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb && rm -f ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcamd2_5.7.1+dfsg-2_amd64.deb
RUN apt install -y ./libcamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libcamd2_5.7.1+dfsg-2_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcolamd2_5.7.1+dfsg-2_amd64.deb
RUN apt install -y ./libcolamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libcolamd2_5.7.1+dfsg-2_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libamd2_5.7.1+dfsg-2_amd64.deb
RUN apt install -y ./libamd2_5.7.1+dfsg-2_amd64.deb && rm -f ./libamd2_5.7.1+dfsg-2_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcholmod3_5.7.1+dfsg-2_amd64.deb
RUN apt install -y ./libcholmod3_5.7.1+dfsg-2_amd64.deb && rm -f ./libcholmod3_5.7.1+dfsg-2_amd64.deb

RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libncurses5_6.2-0ubuntu2.1_amd64.deb
RUN apt install -y ./libncurses5_6.2-0ubuntu2.1_amd64.deb && rm -f ./libncurses5_6.2-0ubuntu2.1_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mime-support/mime-support_3.66_all.deb
RUN apt install -y ./mime-support_3.66_all.deb && rm -f ./mime-support_3.66_all.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb
RUN apt install -y ./libffi7_3.3-5ubuntu1_amd64.deb && rm -f ./libffi7_3.3-5ubuntu1_amd64.deb

RUN wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mpdecimal/libmpdec2_2.4.2-3_amd64.deb
RUN apt install -y ./libmpdec2_2.4.2-3_amd64.deb && rm -f ./libmpdec2_2.4.2-3_amd64.deb
RUN \
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_amd64.deb && \
apt install -y ./libtinfo5_6.2-0ubuntu2.1_amd64.deb && \
rm -f ./libtinfo5_6.2-0ubuntu2.1_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb && \
apt install -y ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb && \
rm -f ./libsuitesparseconfig5_5.10.1+dfsg-4build1_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/s/suitesparse/libccolamd2_5.10.1+dfsg-4build1_amd64.deb && \
apt install -y ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb && \
rm -f ./libccolamd2_5.10.1+dfsg-4build1_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcamd2_5.7.1+dfsg-2_amd64.deb && \
apt install -y ./libcamd2_5.7.1+dfsg-2_amd64.deb && \
rm -f ./libcamd2_5.7.1+dfsg-2_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcolamd2_5.7.1+dfsg-2_amd64.deb && \
apt install -y ./libcolamd2_5.7.1+dfsg-2_amd64.deb && \
rm -f ./libcolamd2_5.7.1+dfsg-2_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libamd2_5.7.1+dfsg-2_amd64.deb && \
apt install -y ./libamd2_5.7.1+dfsg-2_amd64.deb && \
rm -f ./libamd2_5.7.1+dfsg-2_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/s/suitesparse/libcholmod3_5.7.1+dfsg-2_amd64.deb && \
apt install -y ./libcholmod3_5.7.1+dfsg-2_amd64.deb && \
rm -f ./libcholmod3_5.7.1+dfsg-2_amd64.deb && \
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libncurses5_6.2-0ubuntu2.1_amd64.deb && \
apt install -y ./libncurses5_6.2-0ubuntu2.1_amd64.deb && \
rm -f ./libncurses5_6.2-0ubuntu2.1_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mime-support/mime-support_3.66_all.deb && \
apt install -y ./mime-support_3.66_all.deb && \
rm -f ./mime-support_3.66_all.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb && \
apt install -y ./libffi7_3.3-5ubuntu1_amd64.deb && \
rm -f ./libffi7_3.3-5ubuntu1_amd64.deb && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/m/mpdecimal/libmpdec2_2.4.2-3_amd64.deb && \
apt install -y ./libmpdec2_2.4.2-3_amd64.deb && \
rm -f ./libmpdec2_2.4.2-3_amd64.deb

# Download the AMD GPU installer package
RUN wget https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/jammy/amdgpu-install_6.1.60103-1_all.deb

RUN apt install -y ./amdgpu-install_6.1.60103-1_all.deb && rm -f ./amdgpu-install_6.1.60103-1_all.deb

RUN amdgpu-install -y --usecase=wsl,rocm --no-dkms
RUN wget https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/jammy/amdgpu-install_6.1.60103-1_all.deb && \
apt install -y ./amdgpu-install_6.1.60103-1_all.deb && \
rm -f ./amdgpu-install_6.1.60103-1_all.deb && \
amdgpu-install -y --usecase=wsl,rocm --no-dkms

###
# Set the working directory for VapourSynth
Expand Down Expand Up @@ -292,9 +293,9 @@ RUN ln -s /usr/local/lib/libbm3dcpu.so /usr/local/lib/vapoursynth/libbm3dcpu.so
###

# install python packages with specific versions!!!
RUN pip install numpy==1.26.4
RUN pip install opencv-python-headless==4.10.0.82

RUN pip install \
numpy==1.26.4 \
opencv-python==4.10.0.84

# install vsutil
RUN pip install vsutil==0.8.0
Expand Down Expand Up @@ -323,11 +324,18 @@ RUN pip install git+https://github.com/HomeOfVapourSynthEvolution/mvsfunc.git
RUN pip install git+https://github.com/HomeOfVapourSynthEvolution/havsfunc.git

# install PyTorch
RUN wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/torch-2.1.2%2Brocm6.1.3-cp310-cp310-linux_x86_64.whl
RUN wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/torchvision-0.16.1%2Brocm6.1.3-cp310-cp310-linux_x86_64.whl
RUN wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/pytorch_triton_rocm-2.1.0%2Brocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl
RUN pip install torch-2.1.2+rocm6.1.3-cp310-cp310-linux_x86_64.whl torchvision-0.16.1+rocm6.1.3-cp310-cp310-linux_x86_64.whl pytorch_triton_rocm-2.1.0+rocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl
#RUN pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.1
RUN wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/torch-2.1.2%2Brocm6.1.3-cp310-cp310-linux_x86_64.whl && \
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/torchvision-0.16.1%2Brocm6.1.3-cp310-cp310-linux_x86_64.whl && \
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/pytorch_triton_rocm-2.1.0%2Brocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl && \
pip install \
torch-2.1.2+rocm6.1.3-cp310-cp310-linux_x86_64.whl \
torchvision-0.16.1+rocm6.1.3-cp310-cp310-linux_x86_64.whl \
pytorch_triton_rocm-2.1.0+rocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl && \
rm -f \
torch-2.1.2+rocm6.1.3-cp310-cp310-linux_x86_64.whl \
torchvision-0.16.1+rocm6.1.3-cp310-cp310-linux_x86_64.whl \
pytorch_triton_rocm-2.1.0+rocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl

# Locate the torch library directory, HACK
RUN location=$(pip show torch | grep Location | awk -F ": " '{print $2}') && \
Expand All @@ -336,6 +344,7 @@ RUN location=$(pip show torch | grep Location | awk -F ": " '{print $2}') && \
cp /opt/rocm/lib/libhsa-runtime64.so.1.2 libhsa-runtime64.so

# install TensoRaws's packages
RUN pip install mbfunc==0.1.0
RUN pip install ccrestoration==0.2.1
RUN pip install ccvfi==0.0.1
RUN pip install \
mbfunc==0.1.0 \
ccrestoration==0.2.1 \
ccvfi==0.0.1
18 changes: 11 additions & 7 deletions vs-pytorch.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ WORKDIR /cuda
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \
dpkg -i cuda-keyring_1.1-1_all.deb && \
apt update && \
apt install -y cuda-nvcc-12-4 cuda-cudart-dev-12-4 cuda-nvrtc-dev-12-4 libcufft-dev-12-4
apt install -y cuda-nvcc-12-4 cuda-cudart-dev-12-4 cuda-nvrtc-dev-12-4 libcufft-dev-12-4 && \
apt clean

# set up environment variables
ENV PATH=/usr/local/cuda/bin:${PATH}
Expand Down Expand Up @@ -278,8 +279,9 @@ RUN cp VapourSynth-ILS/build/libils.so /usr/local/lib && \
###

# install python packages with specific versions!!!
RUN pip install numpy==1.26.4
RUN pip install opencv-python-headless==4.10.0.82
RUN pip install \
numpy==1.26.4 \
opencv-python==4.10.0.84

# install vsutil
RUN pip install vsutil==0.8.0
Expand Down Expand Up @@ -308,12 +310,14 @@ RUN pip install git+https://github.com/HomeOfVapourSynthEvolution/mvsfunc.git
RUN pip install git+https://github.com/HomeOfVapourSynthEvolution/havsfunc.git

# install PyTorch
RUN pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
RUN pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121 && \
pip cache purge

# install CuPy
RUN pip install cupy-cuda12x

# install TensoRaws's packages
RUN pip install mbfunc==0.1.0
RUN pip install ccrestoration==0.2.1
RUN pip install ccvfi==0.0.1
RUN pip install \
mbfunc==0.1.0 \
ccrestoration==0.2.1 \
ccvfi==0.0.1

0 comments on commit 0c6d709

Please sign in to comment.