Skip to content

Commit

Permalink
FIX improvements from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
dantegd committed Oct 4, 2023
1 parent 3943e16 commit 2e6d40b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 40 deletions.
38 changes: 12 additions & 26 deletions raft-ann-bench/cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 11 additions & 14 deletions raft-ann-bench/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2e6d40b

Please sign in to comment.