| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 |
|
|
| ARG ENV_NAME=059_test |
| ARG CONDA_MIRROR=origin |
| ARG PIP_STRICT=0 |
|
|
| ENV DEBIAN_FRONTEND=noninteractive \ |
| LANG=C.UTF-8 \ |
| LC_ALL=C.UTF-8 \ |
| TZ=Etc/UTC \ |
| MAMBA_ROOT_PREFIX=/home/miniconda3 \ |
| CONDA_PREFIX=/home/miniconda3/envs/${ENV_NAME} \ |
| PIP_NO_CACHE_DIR=1 |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| ca-certificates curl wget git bzip2 build-essential gcc g++ make coreutils \ |
| libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 libgomp1 \ |
| libstdc++6 procps less vim-tiny \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest \ |
| | tar -xvj -C /usr/local/bin --strip-components=1 bin/micromamba |
|
|
| COPY explicit.txt /tmp/explicit.txt |
| RUN set -eux; \ |
| cp /tmp/explicit.txt /tmp/explicit.active.txt; \ |
| if [ "$CONDA_MIRROR" = "tuna" ]; then \ |
| sed -i -E \ |
| -e 's#https?://conda\.anaconda\.org/conda-forge/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/#g' \ |
| -e 's#https?://conda\.anaconda\.org/bioconda/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/#g' \ |
| -e 's#https?://conda\.anaconda\.org/pytorch/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/#g' \ |
| -e 's#https?://conda\.anaconda\.org/nvidia/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/nvidia/#g' \ |
| -e 's#https?://conda\.anaconda\.org/fastai/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/#g' \ |
| -e 's#https?://conda\.anaconda\.org/rapidsai/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/rapidsai/#g' \ |
| -e 's#https?://repo\.anaconda\.com/pkgs/main/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/#g' \ |
| -e 's#https?://repo\.anaconda\.com/pkgs/r/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/#g' \ |
| -e 's#https?://repo\.anaconda\.com/pkgs/msys2/#https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/#g' \ |
| /tmp/explicit.active.txt; \ |
| fi; \ |
| micromamba create -y -p "$CONDA_PREFIX" --file /tmp/explicit.active.txt; \ |
| micromamba clean -a -y; \ |
| rm -f /tmp/explicit.txt /tmp/explicit.active.txt |
|
|
| COPY pip-clean.txt /tmp/pip-clean.txt |
| RUN set -eux; \ |
| failed=0; \ |
| if [ -s /tmp/pip-clean.txt ]; then \ |
| pip_bin="$CONDA_PREFIX/bin/pip"; \ |
| grep -vE "^(git\+|.* @ (git\+|https?://(github|raw\.githubusercontent)\.com))" /tmp/pip-clean.txt > /tmp/pip-pypi.txt || true; \ |
| grep -E "^(git\+|.* @ (git\+|https?://(github|raw\.githubusercontent)\.com))" /tmp/pip-clean.txt > /tmp/pip-git.txt || true; \ |
| while IFS= read -r line; do \ |
| [ -n "$line" ] || continue; \ |
| case "$line" in \ |
| "$pip_bin" install --no-input --no-deps --ignore-requires-python --prefer-binary "$line" \ |
| || { echo "pip failed: $line"; failed=$((failed + 1)); }; \ |
| done < /tmp/pip-pypi.txt; \ |
| while IFS= read -r line; do \ |
| [ -n "$line" ] || continue; \ |
| case "$line" in \ |
| timeout 300 "$pip_bin" install --no-input --no-deps --ignore-requires-python "$line" \ |
| || { echo "pip git failed or timed out: $line"; failed=$((failed + 1)); }; \ |
| done < /tmp/pip-git.txt; \ |
| fi; \ |
| if [ "$PIP_STRICT" = "1" ] && [ "$failed" -gt 0 ]; then exit 1; fi; \ |
| rm -rf /root/.cache/pip /tmp/pip-clean.txt /tmp/pip-pypi.txt /tmp/pip-git.txt |
|
|
| COPY editable.txt /tmp/editable.txt |
|
|
| WORKDIR /workspace |
|
|
| ENV PATH=/home/miniconda3/envs/${ENV_NAME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ |
| LD_LIBRARY_PATH=/home/miniconda3/envs/${ENV_NAME}/lib |
|
|
| CMD ["bash", "-lc", "python -V && which python && echo READY: $CONDA_PREFIX"] |
|
|