Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing and refactoring of rocker scripts #441

Merged
merged 25 commits into from
May 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0bcb2ca
support installing RStudio Server for Ubuntu 22.04
eitsupi Apr 29, 2022
c7dc016
add a test case for installing RStudio daily build on ubuntu:latest
eitsupi Apr 29, 2022
4c0e8ca
add tests for `rocker/binder` and `install_julia.sh`
eitsupi May 1, 2022
e8a70b3
`install_binder.sh` needs non-root user, so set up the non-root user …
eitsupi May 1, 2022
acda48e
add installation of necessary packages
eitsupi May 1, 2022
56dc7d9
run `install_python.sh` in `install_binder.sh` to install dependences
eitsupi May 1, 2022
af11c28
add installation of R remotes package to install R packages from GitHub
eitsupi May 1, 2022
760b4e8
add installation of libzmq3-dev, to install IRkernel
eitsupi May 1, 2022
dbe2ad2
remove unused line and add a note
eitsupi May 1, 2022
04d84f0
update rocker/binder
eitsupi May 1, 2022
069133b
update Dockerfiles by `make setup`
eitsupi May 1, 2022
bae0eb6
fix incorrectly edited Python package install command
eitsupi May 1, 2022
8d8463f
Merge branch 'master' into rstudio-for-jammy
eitsupi May 2, 2022
7d24be4
Merge branch 'master' into scripts-run-alone
eitsupi May 2, 2022
9d49cd0
exec `apt-get update` only if package installation is required
eitsupi May 2, 2022
9e19a64
If git is not installed, skip git configuration
eitsupi May 2, 2022
6a5c26a
Merge pull request #435 from eitsupi/rstudio-for-jammy
eitsupi May 3, 2022
7eae8b3
add `install_cuda-*.sh` installation test
eitsupi May 3, 2022
e6cd271
add new GPG key
eitsupi May 3, 2022
8fbcbf1
Replace apt install with a function to avoid unnecessary apt updates
eitsupi May 3, 2022
1f3df3c
re-add the required apt update that was deleted
eitsupi May 3, 2022
1f49a18
Merge branch 'eitsupi/refactoring-scripts-and-minor-improvement' into…
eitsupi May 4, 2022
3294fc1
Merge pull request #438 from eitsupi/scripts-run-alone
eitsupi May 4, 2022
3f90362
Replace apt install with a function to avoid unnecessary apt updates
eitsupi May 4, 2022
4dd87e1
add test for `config_R_cuda.sh`
eitsupi May 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/scripts-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
- name: Prepare build
id: prep
run: |
test_name="${{ matrix.base_image }}-${{ matrix.tag }}-${{ matrix.script_name }}-${{ matrix.script_arg }}"
lower_script_name=$(echo ${{ matrix.script_name }} | tr '[:upper:]' '[:lower:]')
test_name="${{ matrix.base_image }}-${{ matrix.tag }}-${lower_script_name}-${{ matrix.script_arg }}"
echo ::set-output name=output_tag::"${test_name/"/"/"-"}"
- name: test build
run: |
Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.0.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.0.1.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.0.2.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.0.3.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.0.4.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.0.5.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.1.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.1.1.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.1.2.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.1.3.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_4.2.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/binder_devel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \

ENV NB_USER=rstudio

RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_binder.sh

EXPOSE 8888

CMD jupyter notebook --ip 0.0.0.0
CMD ["/bin/sh", "-c", "jupyter notebook --ip 0.0.0.0"]

USER ${NB_USER}

Expand Down
6 changes: 4 additions & 2 deletions scripts/default_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ if [ -x "$(command -v shiny-server)" ]; then
fi

## configure git not to request password each time
git config --system credential.helper 'cache --timeout=3600'
git config --system push.default simple
if [ -x "$(command -v git)" ]; then
git config --system credential.helper 'cache --timeout=3600'
git config --system push.default simple
fi
49 changes: 37 additions & 12 deletions scripts/install_binder.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
#!/bin/bash
set -e

## force install of last working version of rstudio, if necessary
# RSTUDIO_VERSION=1.3.959 /rocker_scripts/install_rstudio.sh
## build ARGs
NCPUS=${NCPUS:-"-1"}

NB_USER=${NB_USER:-${DEFAULT_USER:-"rstudio"}}

# a function to install apt packages only if they are not installed
function apt_install() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
fi
}

apt_install \
sudo \
libzmq3-dev

# set up the default user if it does not exist
if ! id -u "${NB_USER}" >/dev/null 2>&1; then
/rocker_scripts/default_user.sh "${NB_USER}"
fi

# install python
/rocker_scripts/install_python.sh

## NOTE: this runs as user NB_USER!
PYTHON_VENV_PATH=${PYTHON_VENV_PATH:-/opt/venv/reticulate}
DEFAULT_USER=${DEFAULT_USER:-rstudio}
NB_USER=${NB_USER:-${DEFAULT_USER}}
NB_UID=${NB_UID:-1000}
WORKDIR=${WORKDIR:-/home/${NB_USER}}
usermod -l "${NB_USER}" "${DEFAULT_USER}"
# Create a venv dir owned by unprivileged user & set up notebook in it
# This allows non-root to install python libraries if required
mkdir -p "${PYTHON_VENV_PATH}"
chown -R "${NB_USER}" "${PYTHON_VENV_PATH}"

# to use pyenv in a RStudio session, we need to include the PATH in the .profile file
# https://github.com/rocker-org/rocker-versioned2/issues/428
PATH=/opt/pyenv/bin:${PATH}

# And set ENV for R! It doesn't read from the environment...
echo "PATH=${PATH}" >>"${R_HOME}/etc/Renviron.site"
echo "export PATH=${PATH}" >>"${WORKDIR}/.profile"

cd "${WORKDIR}"
## This gets run as user
sudo -u "${NB_USER}" python3 -m venv "${PYTHON_VENV_PATH}"
pip3 install --no-cache-dir jupyter-rsession-proxy notebook jupyterlab >=2.0

R --quiet -e "devtools::install_github('IRkernel/IRkernel')"
python3 -m pip install --no-cache-dir jupyter-rsession-proxy notebook jupyterlab

install2.r --error --skipinstalled -n "$NCPUS" remotes

R --quiet -e "remotes::install_github('IRkernel/IRkernel')"
R --quiet -e "IRkernel::installspec(prefix='${PYTHON_VENV_PATH}')"

# Clean up
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/downloaded_packages
44 changes: 28 additions & 16 deletions scripts/install_cuda-10.1.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
#!/bin/bash
set -e

apt-get update
apt-get install -y --no-install-recommends \
gnupg2 curl ca-certificates
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add -
# a function to install apt packages only if they are not installed
function apt_install() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
apt-get update
fi
apt-get install -y --no-install-recommends "$@"
fi
}

apt_install \
gnupg2 \
curl \
ca-certificates

apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" >/etc/apt/sources.list.d/cuda.list
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" >/etc/apt/sources.list.d/nvidia-ml.list
apt-get purge --autoremove -y curl
rm -rf /var/lib/apt/lists/*
apt-get update

CUDA_VERSION=${CUDA_VERSION:-10.1.243}
CUDA_PKG_VERSION=${CUDA_PKG_VERSION:-10-1=$CUDA_VERSION-1}

# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
apt-get update
apt-get install -y --no-install-recommends \
apt_install \
"cuda-cudart-${CUDA_PKG_VERSION}" \
cuda-compat-10-1 &&
ln -s cuda-10.1 /usr/local/cuda &&
rm -rf /var/lib/apt/lists/*
cuda-compat-10-1

ln -s cuda-10.1 /usr/local/cuda

# Required for nvidia-docker v1
echo "/usr/local/nvidia/lib" >>/etc/ld.so.conf.d/nvidia.conf &&
Expand Down Expand Up @@ -47,8 +58,7 @@ LIBNVINFER_MAJOR_VERSION=6
# There appears to be a regression in libcublas10=10.2.2.89-1 which
# prevents cublas from initializing in TF. See
# https://github.com/tensorflow/tensorflow/issues/9489#issuecomment-562394257
apt-get update
apt-get install -y --no-install-recommends --allow-downgrades \
apt_install \
build-essential \
cuda-command-line-tools-10-1 \
libcublas10=10.2.1.243-1 \
Expand All @@ -67,11 +77,10 @@ apt-get install -y --no-install-recommends --allow-downgrades \
unzip

# Install TensorRT if not building for PowerPC
apt-get update
apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \
apt_install \
libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \
libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA}
apt-get clean
rm -rf /var/lib/apt/lists/*

# For CUDA profiling, TensorFlow requires CUPTI.
LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH}
Expand All @@ -87,3 +96,6 @@ ldconfig

## Add tensorflow-gpu==1.15 dependencies on the CUDA 10.0 libraries:
/rocker_scripts/install_tf1_cuda_10_0.sh

# Clean up
rm -rf /var/lib/apt/lists/*
Loading