diff --git a/.github/workflows/build-and-push-to-docker.yml b/.github/workflows/build-and-push-to-docker.yml index 98b512bb..eab3813c 100644 --- a/.github/workflows/build-and-push-to-docker.yml +++ b/.github/workflows/build-and-push-to-docker.yml @@ -38,6 +38,7 @@ jobs: - docker/cuda/Dockerfile - docker/vnc/Dockerfile - docker/matlab/Dockerfile + - docker/matlab-jupyter/Dockerfile - docker/julia/Dockerfile - docker/batch/Dockerfile - docker/qgis/Dockerfile @@ -88,7 +89,7 @@ jobs: uses: docker/build-push-action@v5 with: build-args: | - BASE_IMAGE=${{ matrix.REGISTRY }}/jupyter/base-notebook:python-${{ matrix.BASE_PYTHON_VERSION }} + BASE_IMAGE=${{ matrix.REGISTRY }}/jupyter/base-notebook:python-${{ matrix.BASE_PYTHON_VERSION }} cache-from: type=gha cache-to: type=gha,mode=max context: docker/py @@ -117,7 +118,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} provenance: false - + build-py-homedir-env: needs: lint runs-on: ubuntu-latest @@ -148,12 +149,12 @@ jobs: tags: | type=sha,prefix=${{ matrix.BASE_PYTHON_VERSION }}- type=semver,pattern={{version}},prefix=${{ matrix.BASE_PYTHON_VERSION }}- - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.BASE_PYTHON_VERSION == env.DEFAULT_PYTHON_VERSION }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.BASE_PYTHON_VERSION == env.DEFAULT_PYTHON_VERSION }} - name: Build and load uses: docker/build-push-action@v5 with: build-args: | - BASE_IMAGE=jupyter/base-notebook:python-${{ matrix.BASE_PYTHON_VERSION }} + BASE_IMAGE=jupyter/base-notebook:python-${{ matrix.BASE_PYTHON_VERSION }} CONDA_ENVS_DIRS=/home/jovyan/work/envs cache-from: type=gha cache-to: type=gha,mode=max @@ -216,7 +217,7 @@ jobs: tags: | type=sha,prefix=${{ matrix.BASE_PYTHON_VERSION }}- type=semver,pattern={{version}},prefix=${{ matrix.BASE_PYTHON_VERSION }}- - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.BASE_PYTHON_VERSION == env.DEFAULT_PYTHON_VERSION }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.BASE_PYTHON_VERSION == env.DEFAULT_PYTHON_VERSION }} - name: Build and push uses: docker/build-push-action@v5 with: @@ -227,7 +228,7 @@ jobs: cache-to: type=gha,mode=max cache-from: type=gha build-args: | - BASE_IMAGE=jupyter/base-notebook:python-${{ matrix.BASE_PYTHON_VERSION }} + BASE_IMAGE=jupyter/base-notebook:python-${{ matrix.BASE_PYTHON_VERSION }} platforms: linux/amd64,linux/arm64 provenance: false @@ -307,7 +308,7 @@ jobs: build-args: | RENKU_BASE=${{ steps.vars.outputs.renku_base }} CUDA_COMPAT_PACKAGE=${{ matrix.CUDA_COMPAT_PACKAGE }} - CUDA_CUDART_PACKAGE=${{ matrix.CUDA_CUDART_PACKAGE }} + CUDA_CUDART_PACKAGE=${{ matrix.CUDA_CUDART_PACKAGE }} CUDA_VERSION=${{ matrix.CUDA_VERSION }} EXTRA_LIBRARIES=${{ matrix.EXTRA_LIBRARIES }} LIBCUDNN_PACKAGE=${{ matrix.LIBCUDNN_PACKAGE }} @@ -335,16 +336,16 @@ jobs: build-args: | RENKU_BASE=${{ steps.vars.outputs.renku_base }} CUDA_COMPAT_PACKAGE=${{ matrix.CUDA_COMPAT_PACKAGE }} - CUDA_CUDART_PACKAGE=${{ matrix.CUDA_CUDART_PACKAGE }} + CUDA_CUDART_PACKAGE=${{ matrix.CUDA_CUDART_PACKAGE }} CUDA_VERSION=${{ matrix.CUDA_VERSION }} - EXTRA_LIBRARIES=${{ matrix.EXTRA_LIBRARIES }} - LIBCUDNN_PACKAGE=${{ matrix.LIBCUDNN_PACKAGE }} + EXTRA_LIBRARIES=${{ matrix.EXTRA_LIBRARIES }} + LIBCUDNN_PACKAGE=${{ matrix.LIBCUDNN_PACKAGE }} context: docker/cuda labels: ${{ steps.meta.outputs.labels }} push: true tags: ${{ steps.meta.outputs.tags }} provenance: false - + build-py-ext: needs: build-py runs-on: ubuntu-latest @@ -359,6 +360,8 @@ jobs: PYTHON_VERSION: "3.11" - EXTENSION: batch PYTHON_VERSION: "3.10" + - EXTENSION: matlab-jupyter + PYTHON_VERSION: "3.10" steps: - name: Docker Login uses: Azure/docker-login@v1 @@ -395,7 +398,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha provenance: false - + build-vnc-ext: needs: build-py-ext runs-on: ubuntu-latest @@ -440,7 +443,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha provenance: false - + build-julia-ext: needs: build-py runs-on: ubuntu-latest @@ -448,14 +451,14 @@ jobs: strategy: fail-fast: true matrix: - include: + include: - JULIA_VERSION: "1.7.1" JULIA_CHECKSUM: "44658e9c7b45e2b9b5b59239d190cca42de05c175ea86bc346c294a8fe8d9f11" - JULIA_VERSION: "1.8.5" JULIA_CHECKSUM: "e71a24816e8fe9d5f4807664cbbb42738f5aa9fe05397d35c81d4c5d649b9d05" - JULIA_VERSION: "1.9.0" JULIA_CHECKSUM: "00c614466ef9809c2eb23480e38d196a2c577fff2730c4f83d135b913d473359" - + steps: - name: Docker Login uses: Azure/docker-login@v1 @@ -517,11 +520,11 @@ jobs: tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha provenance: false - + build-r-ubuntu: needs: build-py runs-on: ubuntu-latest - env: + env: RSTUDIO_VERSION: 2022.02.3-492 strategy: fail-fast: true diff --git a/Makefile b/Makefile index db497e97..9f8ee148 100644 --- a/Makefile +++ b/Makefile @@ -167,6 +167,13 @@ batch: py -t $(DOCKER_PREFIX)-batch:$(EXTRA_DOCKER_LABEL) \ $(BUILDX_EXTRA_FLAGS) +matlab-jupyter: py + docker $(BUILD_CMD) docker/matlab-jupyter \ + --build-arg RENKU_BASE="$(RENKU_BASE)" \ + --build-arg BASE_IMAGE=mathworks/matlab:r2024a \ + -t $(DOCKER_PREFIX)-matlab-jupyter:$(EXTRA_DOCKER_LABEL) \ + $(BUILDX_EXTRA_FLAGS) + bioc: py docker $(BUILD_CMD) docker/r \ --build-arg RENKU_BASE="$(RENKU_BASE)" \ diff --git a/docker/matlab-jupyter/Dockerfile b/docker/matlab-jupyter/Dockerfile new file mode 100644 index 00000000..faa75335 --- /dev/null +++ b/docker/matlab-jupyter/Dockerfile @@ -0,0 +1,74 @@ +# define build arguments +ARG RENKU_BASE=renku/renkulab-py:latest +ARG BASE_IMAGE=mathworks/matlab:r2024a + +# define base images +FROM $RENKU_BASE as renku_base +FROM $BASE_IMAGE + +LABEL maintainer="Swiss Data Science Center " + +USER root + +ENV NB_USER matlab +ENV NB_UID 1000 +ENV NB_GID 100 +ENV VENV_DIR /srv/venv +ENV HOME /home/${NB_USER} +ENV SHELL bash +ENV CONDA_PATH /opt/conda +SHELL [ "/bin/bash", "-c", "-o", "pipefail" ] + +# prepend conda and local/bin to PATH +ENV PATH ${HOME}/.local/bin:${CONDA_PATH}/bin:${HOME}/.renku/bin:$PATH + +# Add Tini +ENV TINI_VERSION v0.18.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini +RUN chmod +x /tini && ln -s /tini /usr/bin/ + +# install dependencies +RUN apt-get update --fix-missing && \ + apt-get install -yq --no-install-recommends \ + bzip2 \ + ca-certificates \ + curl \ + git \ + gpg-agent \ + rclone \ + vim && \ + apt-get purge && \ + apt-get clean && \ + apt-get autoremove --yes && \ + rm -rf /var/lib/apt/lists/* && \ + curl -L -s https://github.com/git-lfs/git-lfs/releases/download/v3.3.0/git-lfs-linux-"$(dpkg --print-architecture)"-v3.3.0.tar.gz -o /tmp/git-lfs-linux-"$(dpkg --print-architecture)"-v3.3.0.tar.gz && \ + tar -zxvf /tmp/git-lfs-linux-"$(dpkg --print-architecture)"-v3.3.0.tar.gz -C /tmp && \ + /tmp/git-lfs-3.3.0/install.sh && \ + rm -rf /tmp/git-lfs* + +# inject the renku-jupyter stack +COPY --from=renku_base /opt/conda /opt/conda +COPY --from=renku_base --chown=matlab:matlab /usr/local/bin/ /usr/local/bin/ +COPY --from=renku_base --chown=matlab:matlab /home/jovyan/ /home/matlab/ +COPY --from=renku_base /entrypoint.sh /entrypoint.sh +COPY --from=renku_base /renku/bashrc /renku/bashrc + +# set permissions of the R library directory to be editable by NB_USER +RUN chown 1000:100 /opt/conda && \ + # this hack lets some of the setup from the base renku image work here + ln -s /home/${NB_USER} /home/jovyan + +USER ${NB_USER} + +# set up conda in the NB_USER environment +RUN echo ". ${CONDA_PATH}/etc/profile.d/conda.sh" >> ~/.bashrc && \ + echo "conda activate base" >> ~/.bashrc && \ + cat /renku/bashrc >> $HOME/.bashrc && \ + echo "source ~/.bashrc" >> ~/.bash_profile + +RUN pip install --no-cache-dir "jupyter-matlab-proxy" + +ENTRYPOINT [ "/tini", "--", "/entrypoint.sh" ] +CMD [ "jupyter", "server", "--ip", "0.0.0.0" ] + +WORKDIR ${HOME}