forked from nomadkaraoke/python-audio-separator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Use the latest CUDA 12 runtime as base image | ||
FROM nvidia/cuda:12.3.1-devel-ubuntu22.04 | ||
|
||
# Set the working directory in the container | ||
WORKDIR /workdir | ||
|
||
ARG MINIFORGE_NAME=Miniforge3 | ||
ARG MINIFORGE_VERSION=23.3.1-1 | ||
ARG TARGETPLATFORM | ||
|
||
ENV CONDA_DIR=/opt/conda | ||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | ||
ENV PATH=${CONDA_DIR}/bin:${PATH} | ||
|
||
# 1. Install just enough for conda to work | ||
# 2. Keep $HOME clean (no .wget-hsts file), since HSTS isn't useful in this context | ||
# 3. Install miniforge from GitHub releases | ||
# 4. Apply some cleanup tips from https://jcrist.github.io/conda-docker-tips.html | ||
# Particularly, we remove pyc and a files. The default install has no js, we can skip that | ||
# 5. Activate base by default when running as any *non-root* user as well | ||
# Good security practice requires running most workloads as non-root | ||
# This makes sure any non-root users created also have base activated | ||
# for their interactive shells. | ||
# 6. Activate base by default when running as root as well | ||
# The root user is already created, so won't pick up changes to /etc/skel | ||
RUN apt-get update > /dev/null && \ | ||
apt-get install --no-install-recommends --yes \ | ||
wget bzip2 ca-certificates \ | ||
git \ | ||
tini \ | ||
> /dev/null && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/${MINIFORGE_NAME}-${MINIFORGE_VERSION}-Linux-$(uname -m).sh -O /tmp/miniforge.sh && \ | ||
/bin/bash /tmp/miniforge.sh -b -p ${CONDA_DIR} && \ | ||
rm /tmp/miniforge.sh && \ | ||
conda clean --tarballs --index-cache --packages --yes && \ | ||
find ${CONDA_DIR} -follow -type f -name '*.a' -delete && \ | ||
find ${CONDA_DIR} -follow -type f -name '*.pyc' -delete && \ | ||
conda clean --force-pkgs-dirs --all --yes && \ | ||
echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> /etc/skel/.bashrc && \ | ||
echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> ~/.bashrc | ||
|
||
# Install pytorch with CUDA | ||
RUN --mount=type=cache,target=/opt/conda/pkgs mamba install -y pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia | ||
|
||
# Install onnxruntime with CUDA | ||
RUN --mount=type=cache,target=/opt/conda/pkgs mamba install -y onnxruntime=*=*cuda* | ||
|
||
# Install audio-separator | ||
RUN --mount=type=cache,target=/opt/conda/pkgs mamba install -y audio-separator |