From 2e6d40bc6f131fe30ab5d79d038e19cd4fe42661 Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Wed, 4 Oct 2023 17:42:58 -0500 Subject: [PATCH] FIX improvements from PR review --- raft-ann-bench/cpu/Dockerfile | 38 +++++++++++------------------------ raft-ann-bench/gpu/Dockerfile | 25 ++++++++++------------- 2 files changed, 23 insertions(+), 40 deletions(-) diff --git a/raft-ann-bench/cpu/Dockerfile b/raft-ann-bench/cpu/Dockerfile index cbf23224..5925a936 100644 --- a/raft-ann-bench/cpu/Dockerfile +++ b/raft-ann-bench/cpu/Dockerfile @@ -7,39 +7,25 @@ FROM condaforge/mambaforge:23.3.1-0 as raft-ann-bench-cpu ARG RAPIDS_VER ARG PYTHON_VER -# Create a conda group and assign it as root's primary group -RUN groupadd conda; \ - usermod -g conda root - -# Ensure new files are created with group write access & setgid. See https://unix.stackexchange.com/a/12845 -# /opt/conda will need to be accessible by every user to support the flag -u $(id -u) -RUN chown root:conda /opt/conda \ - && chmod -R 777 /opt/conda - -# Reassign root's primary group to root -RUN usermod -g root root +COPY condarc /opt/conda/.condarc # Create a data folder accessible by any user so mounted volumes under it can be accessible # when the user passes their uid to docker run with -u $(id -u) RUN mkdir /data && chmod 777 /data -RUN useradd -rm -d /home/rapids -s /bin/bash -g conda -u 1001 rapids -USER rapids - -WORKDIR /home/rapids - -COPY condarc /opt/conda/.condarc +# temporarily downgrade conda from 23.9.0 due to https://github.com/mamba-org/mamba/issues/2882 +# after the mamba update step RUN mamba update --all -y -n base \ - &&mamba install -y -n base \ - "raft-ann-bench-cpu=${RAPIDS_VER}.*" \ - "python=${PYTHON_VER}" \ - && conda clean -afy - -# we need to change the permissions of the conda folder so that all users can execute -# particularly the user passed by -u $(id -u) -USER root -RUN chmod -R 777 /opt/conda + && conda install -y -n base conda==23.7.4 \ + && mamba install -y -n base \ + "raft-ann-bench-cpu=${RAPIDS_VER}.*" \ + "python=${PYTHON_VER}" \ + && conda clean -afy \ + && chmod -R 777 /opt/conda + +RUN useradd -rm -d /home/rapids -s /bin/bash -u 1001 rapids USER rapids +WORKDIR /home/rapids COPY raft-ann-bench/run_benchmark.sh /data/scripts/run_benchmark.sh diff --git a/raft-ann-bench/gpu/Dockerfile b/raft-ann-bench/gpu/Dockerfile index 24c48912..05f76703 100644 --- a/raft-ann-bench/gpu/Dockerfile +++ b/raft-ann-bench/gpu/Dockerfile @@ -10,31 +10,28 @@ FROM rapidsai/mambaforge-cuda:cuda${CUDA_VER}-base-${LINUX_VER}-py${PYTHON_VER} ARG CUDA_VER ARG RAPIDS_VER +COPY condarc /opt/conda/.condarc + # Create a data folder accessible by any user so mounted volumes under it can be accessible # when the user passes their uid to docker run with -u $(id -u) RUN mkdir /data && chmod 777 /data -RUN useradd -rm -d /home/rapids -s /bin/bash -g conda -u 1001 rapids -# rapids is the default user, but users can use the -u docker run flag to write/read to mounted volumes. -USER rapids - -WORKDIR /home/rapids - -COPY condarc /opt/conda/.condarc +# temporarily downgrade conda from 23.9.0 due to https://github.com/mamba-org/mamba/issues/2882 +# after the mamba update step RUN mamba update --all -y -n base \ + && conda install -y -n base conda==23.7.4 \ && mamba install -y -n base \ "raft-ann-bench=${RAPIDS_VER}.*" \ "cuda-version=${CUDA_VER%.*}.*" \ "rmm=${RAPIDS_VER}.*" \ - && conda clean -afy - -# Change the permissions of the conda folder so that all users can execute, -# particularly the user passed by -u $(id -u) -USER root -RUN chmod -R 777 /opt/conda + && conda clean -afy \ + && chmod -R 777 /opt/conda -# switch back to rapids user by default +# We add rapids is the default user in case the user runs without -u, +# but users are encouraged to use the -u docker run flag to write/read to mounted volumes. +RUN useradd -rm -d /home/rapids -s /bin/bash -g conda -u 1001 rapids USER rapids +WORKDIR /home/rapids COPY raft-ann-bench/run_benchmark.sh /data/scripts/run_benchmark.sh