Skip to content

Commit

Permalink
Switch to heredocs (#611)
Browse files Browse the repository at this point in the history
Co-authored-by: AJ Schmidt <[email protected]>
  • Loading branch information
AyodeAwe and ajschmidt8 authored Nov 28, 2023
1 parent 6c84b6b commit 3fc15ee
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 33 deletions.
36 changes: 22 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ARG DASK_SQL_VER

ARG RAPIDS_BRANCH="branch-${RAPIDS_VER}"

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

RUN pip install --upgrade conda-merge rapids-dependency-file-generator

COPY condarc /condarc
Expand All @@ -41,13 +43,15 @@ WORKDIR /home/rapids

COPY condarc /opt/conda/.condarc

RUN mamba install -y -n base \
"rapids=${RAPIDS_VER}.*" \
"dask-sql=${DASK_SQL_VER%.*}.*" \
"python=${PYTHON_VER}.*" \
"cuda-version=${CUDA_VER%.*}.*" \
ipython \
&& conda clean -afy
RUN <<EOF
mamba install -y -n base \
"rapids=${RAPIDS_VER}.*" \
"dask-sql=${DASK_SQL_VER%.*}.*" \
"python=${PYTHON_VER}.*" \
"cuda-version=${CUDA_VER%.*}.*" \
ipython
conda clean -afy
EOF

COPY entrypoint.sh /home/rapids/entrypoint.sh

Expand All @@ -67,15 +71,19 @@ COPY --from=dependencies --chown=rapids /test_notebooks_dependencies.yaml test_n

COPY --from=dependencies --chown=rapids /notebooks /home/rapids/notebooks

RUN mamba env update -n base -f test_notebooks_dependencies.yaml \
&& conda clean -afy
RUN <<EOF
mamba env update -n base -f test_notebooks_dependencies.yaml
conda clean -afy
EOF

RUN mamba install -y -n base \
RUN <<EOF
mamba install -y -n base \
"jupyterlab=3" \
dask-labextension \
&& pip install jupyterlab-nvdashboard \
&& conda clean -afy \
&& pip cache purge
dask-labextension
pip install jupyterlab-nvdashboard
conda clean -afy
pip cache purge
EOF

ENV DASK_LABEXTENSION__FACTORY__MODULE="dask_cuda"
ENV DASK_LABEXTENSION__FACTORY__CLASS="LocalCUDACluster"
Expand Down
26 changes: 16 additions & 10 deletions raft-ann-bench/cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@ ARG PYTHON_VER

COPY condarc /opt/conda/.condarc

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

# 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)
# Also add the conda_prefix config to the global bashrc file so that all users have it correctly configured.
RUN mkdir /data && chmod 777 /data \
&& ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh; \
echo ". /opt/conda/etc/profile.d/conda.sh; conda activate base" >> /etc/bash.bashrc
RUN <<EOF
mkdir /data
chmod 777 /data
echo ". /opt/conda/etc/profile.d/conda.sh; conda activate base" >> /etc/bash.bashrc
EOF

# we need perl temporarily for the remaining benchmark perl scripts
RUN apt-get install perl -y

# Install python before updating environment, otherwise Python 3.9 image
# runs into a solver conflict with truststore 0.8.0. This avoids the environment installing
# packages incompatible with python version needed before python itself is pinned to the correct version.
RUN mamba install -y -n base "python=${PYTHON_VER}" \
&& mamba update --all -y -n base \
&& mamba install -y -n base \
"raft-ann-bench-cpu=${RAPIDS_VER}.*" \
"python=${PYTHON_VER}" \
&& conda clean -afy \
&& chmod -R 777 /opt/conda
RUN <<EOF
mamba install -y -n base "python=${PYTHON_VER}"
mamba update --all -y -n base
mamba install -y -n base \
"raft-ann-bench-cpu=${RAPIDS_VER}.*" \
"python=${PYTHON_VER}"
conda clean -afy
chmod -R 777 /opt/conda
EOF

RUN useradd -rm -d /home/rapids -s /bin/bash -u 1001 rapids
USER rapids
Expand Down
24 changes: 15 additions & 9 deletions raft-ann-bench/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,30 @@ ARG RAPIDS_VER

COPY condarc /opt/conda/.condarc

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

# 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)
# Also add the conda_prefix config to the global bashrc file so that all users have it correctly configured.
RUN mkdir /data && chmod 777 /data \
&& ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh; \
echo ". /opt/conda/etc/profile.d/conda.sh; conda activate base" >> /etc/bash.bashrc
RUN <<EOF
mkdir /data
chmod 777 /data
echo ". /opt/conda/etc/profile.d/conda.sh; conda activate base" >> /etc/bash.bashrc
EOF

# we need perl temporarily for the remaining benchmark perl scripts
RUN apt-get install perl -y

# 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=${RAPIDS_VER}.*" \
"cuda-version=${CUDA_VER%.*}.*" \
&& conda clean -afy \
&& chmod -R 777 /opt/conda
RUN <<EOF
mamba update --all -y -n base
mamba install -y -n base \
"raft-ann-bench=${RAPIDS_VER}.*" \
"cuda-version=${CUDA_VER%.*}.*"
conda clean -afy
chmod -R 777 /opt/conda
EOF

# 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.
Expand Down

0 comments on commit 3fc15ee

Please sign in to comment.