File size: 1,766 Bytes
e8d350a | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # Dockerfile for "conda-pack-style" sample images.
# Image only contains the activated conda env + system toolchain.
# Sample code + pipeline are mounted at runtime via -v.
#
# Build args:
# PACK_FILE e.g. 001_rm_bench_test.tar.gz (file in build context)
# ENV_DIR_NAME e.g. py-001 (folder under /opt/conda/envs)
#
# Build (on remote, from /home/dockerfiles/):
# docker buildx build \
# --build-arg PACK_FILE=001_rm_bench_test.tar.gz \
# --build-arg ENV_DIR_NAME=py-001 \
# -t mmsci-py-001 -f Dockerfile.conda-env .
#
# Run:
# docker run --rm -it --gpus all \
# -v /home/code:/workspace/code:ro \
# -v /home/code/data:/workspace/data:ro \
# mmsci-py-001 bash -lc 'python -V'
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
ARG PACK_FILE
ARG ENV_DIR_NAME
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 LC_ALL=C.UTF-8 \
TZ=Etc/UTC
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl wget git build-essential gcc g++ make \
libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 libgomp1 \
libstdc++6 procps less vim-tiny \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/conda/envs/${ENV_DIR_NAME}
COPY ${PACK_FILE} /tmp/env.tar.gz
RUN tar -xzf /tmp/env.tar.gz -C /opt/conda/envs/${ENV_DIR_NAME} \
&& rm /tmp/env.tar.gz \
&& /opt/conda/envs/${ENV_DIR_NAME}/bin/conda-unpack \
&& echo "env unpacked: ${ENV_DIR_NAME}"
WORKDIR /workspace
ENV PATH=/opt/conda/envs/${ENV_DIR_NAME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV CONDA_PREFIX=/opt/conda/envs/${ENV_DIR_NAME}
ENV LD_LIBRARY_PATH=/opt/conda/envs/${ENV_DIR_NAME}/lib
CMD ["bash", "-lc", "python -V && which python && echo READY: $CONDA_PREFIX"]
|