Skip to content

Commit

Permalink
fixed #12
Browse files Browse the repository at this point in the history
  • Loading branch information
lrlunin committed Jun 24, 2023
1 parent 8d1aa9e commit c3b687a
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 123 deletions.
42 changes: 31 additions & 11 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ on:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME_1: mbi-div-b-notebook-base
IMAGE_NAME_2: mbi-div-b-notebook-cuda
jobs:
push_to_registry:
name: Push Docker image to GitHub Container Registry
Expand All @@ -35,17 +36,36 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
- name: Extract metadata (tags, labels) for Docker 1st image
id: meta1
uses: docker/metadata-action@v4.6.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_1 }}

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
- name: Build and push 1st Docker image
uses: docker/build-push-action@v4.1.1
with:
context: .
file: ./Dockerfile
context: ${{ env.IMAGE_NAME_1 }}
file: ${{ env.IMAGE_NAME_1 }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta1.outputs.tags }}
labels: ${{ steps.meta1.outputs.labels }}

- name: Extract metadata (tags, labels) for Docker 2nd image
id: meta2
uses: docker/metadata-action@v4.6.0
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_2 }}

- name: Build and push 2nd Docker image
uses: docker/build-push-action@v4.1.1
with:
context: ${{ env.IMAGE_NAME_2 }}
build-args: |
BASE_REPO=${{ github.repository_owner }}
REGISTRY=${{ env.REGISTRY }}
}}
file: ${{ env.IMAGE_NAME_2 }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.5
0.2.0
File renamed without changes.
127 changes: 127 additions & 0 deletions mbi-div-b-notebook-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# uses ubuntu:22.04 as the root container.
ARG BASE_CONTAINER=jupyter/minimal-notebook
FROM $BASE_CONTAINER

LABEL maintainer="@lrlunin"
LABEL description="Docker image for the MBI div B JupyterHub"
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014
COPY data/Fira_Sans.zip /tmp/Fira_Sans.zip
COPY scripts /tmp/scripts
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

USER root

RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
# for cython: https://cython.readthedocs.io/en/latest/src/quickstart/install.html
build-essential \
# for latex labels
cm-super \
dvipng \
fontconfig \
# for slsdetectorlib
cmake \
libzmq5-dev \
libtiff5-dev \
# user requests
imagemagick \
# for matplotlib anim
ffmpeg && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN chmod +x /tmp/scripts/install-mbistyles-fonts.sh && /tmp/scripts/install-mbistyles-fonts.sh
RUN chmod +x /tmp/scripts/install-slsdetector-package.sh && /tmp/scripts/install-slsdetector-package.sh



# RUN chmod -R 777 /home/${NB_USER}/.jupyter/

USER ${NB_UID}
#Install Python 3 packages
RUN mamba install --yes \
'altair' \
'beautifulsoup4' \
'bokeh' \
'bottleneck' \
'cloudpickle' \
'conda-forge::blas=*=openblas' \
'cython' \
'dask' \
'dill' \
'h5py' \
'ipympl=0.9.3' \
'ipywidgets=8.0.6' \
'jupyterlab-git' \
'matplotlib-base=3.7.1' \
'numba' \
'numexpr' \
'openpyxl' \
'pandas' \
'patsy' \
'protobuf' \
'pytables' \
'scikit-image' \
'scikit-learn' \
'scipy' \
'seaborn' \
'sqlalchemy' \
'statsmodels' \
'sympy' \
'widgetsnbextension' \
'xlrd' \
'conda-forge::pyfai' \
'jupyterlab-h5web' \
'xarray' \
'netCDF4' \
'conda-forge::dask-labextension' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Install packages missing in mamba with pip
# ultrafastfitfunctions need to be installed from git and commit after accepting the pull request
# https://github.com/EmCeBeh/ultrafastFitFunctions/pull/2
RUN pip install --no-cache-dir udkm1Dsim \
pyEvalData \
git+https://github.com/lrlunin/ultrafastFitFunctions@5bd30901b405dab1b161f59c7c1d5238c2f12991 \
git+https://github.com/MBI-Div-B/mbistyles.git \
nbdime \
jupyterlab-fasta \
jupyterlab-geojson \
jupyterlab-katex \
jupyterlab-mathjax2 \
jupyterlab-vega3 \
jupyterlab-code-formatter \
black && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# copying "new default" settings like black code formatter
COPY --chown=${NB_UID}:${NB_UID} data/user-settings /home/${NB_USER}/.jupyter/lab/user-settings

# jupyterlab-code-formatter needs to be configured
# https://jupyterlab-code-formatter.readthedocs.io/configuration.html
# see more for jupyterhub https://jupyterlab-code-formatter.readthedocs.io/jupyterhub.html
# potentially:
# RUN jupyter serverextension enable --py jupyterlab_code_formatter --sys-prefix

# Install facets which does not have a pip or conda package at the moment
WORKDIR /tmp
RUN git clone https://github.com/PAIR-code/facets.git && \
jupyter nbextension install facets/facets-dist/ --sys-prefix && \
rm -rf /tmp/facets && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Import matplotlib the first time to build the font cache.
ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/"

RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \
fix-permissions "/home/${NB_USER}"

USER ${NB_UID}

WORKDIR "${HOME}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions mbi-div-b-notebook-cuda/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Documentation
README.md
VERSION
119 changes: 8 additions & 111 deletions Dockerfile → mbi-div-b-notebook-cuda/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,20 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# uses ubuntu:22.04 as the root container.
ARG BASE_CONTAINER=jupyter/minimal-notebook
FROM $BASE_CONTAINER
ARG BASE_REPO
ARG REGISTRY
FROM $REGISTRY/$BASE_REPO/mbi-div-b-notebook-base

LABEL maintainer="@lrlunin"
LABEL description="Docker image for the MBI div B JupyterHub"
# Fix: https://github.com/hadolint/hadolint/wiki/DL4006
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014
COPY data/Fira_Sans.zip /tmp/Fira_Sans.zip
COPY scripts /tmp/scripts
LABEL description="Docker image for the MBI div B JupyterHub with cuda API"

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

USER root

# for cuda installation
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
# for cython: https://cython.readthedocs.io/en/latest/src/quickstart/install.html
build-essential \
# for latex labels
cm-super \
dvipng \
fontconfig \
# for slsdetectorlib
cmake \
libzmq5-dev \
libtiff5-dev \
# for cuda installation
apt-utils \
# user requests
imagemagick \
# for matplotlib anim
ffmpeg && \
apt-utils && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN /tmp/scripts/install-mbistyles-fonts.sh
RUN /tmp/scripts/install-slsdetector-package.sh

# cuda installation like https://hub.docker.com/layers/nvidia/cuda/11.7.0-cudnn8-devel-ubuntu22.04/images/sha256-cf262ed40aa17b168184fd9a8d0ac2ae932e2c6d0fe4f08e0598ab50db08a07d?context=explore
# took instructions from its installation steps

Expand Down Expand Up @@ -138,91 +116,10 @@ RUN mkdir /opt/mumax3 && cd /opt/mumax3 && \
#rm mumax3-2020.10.01-Linux.tar.gz && \
#ln -s /opt/mumax3/mumax3 /usr/local/bin/mumax3


USER ${NB_UID}

#Install Python 3 packages
RUN mamba install --yes \
'altair' \
'beautifulsoup4' \
'bokeh' \
'bottleneck' \
'cloudpickle' \
'conda-forge::blas=*=openblas' \
'cython' \
'dask' \
'dill' \
'h5py' \
'ipympl=0.9.3' \
'ipywidgets=8.0.6' \
'jupyterlab-git' \
'matplotlib-base=3.7.1' \
'numba' \
'numexpr' \
'openpyxl' \
'pandas' \
'patsy' \
'protobuf' \
'pytables' \
'scikit-image' \
'scikit-learn' \
'scipy' \
'seaborn' \
'sqlalchemy' \
'statsmodels' \
'sympy' \
'widgetsnbextension' \
'xlrd' \
'conda-forge::pyfai' \
'jupyterlab-h5web' \
'xarray' \
'netCDF4' \
'conda-forge::dask-labextension' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Install packages missing in mamba with pip
# ultrafastfitfunctions need to be installed from git and commit after accepting the pull request
# https://github.com/EmCeBeh/ultrafastFitFunctions/pull/2
RUN pip install --no-cache-dir udkm1Dsim \
pyEvalData \
git+https://github.com/lrlunin/ultrafastFitFunctions@5bd30901b405dab1b161f59c7c1d5238c2f12991 \
git+https://github.com/MBI-Div-B/mbistyles.git \
nbdime \
jupyterlab-fasta \
jupyterlab-geojson \
jupyterlab-katex \
jupyterlab-mathjax2 \
jupyterlab-vega3 \
jupyterlab-code-formatter \
black && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# jupyterlab-code-formatter needs to be configured
# https://jupyterlab-code-formatter.readthedocs.io/configuration.html
# see more for jupyterhub https://jupyterlab-code-formatter.readthedocs.io/jupyterhub.html
# potentially:
# RUN jupyter serverextension enable --py jupyterlab_code_formatter --sys-prefix

# Install facets which does not have a pip or conda package at the moment
WORKDIR /tmp
RUN git clone https://github.com/PAIR-code/facets.git && \
jupyter nbextension install facets/facets-dist/ --sys-prefix && \
rm -rf /tmp/facets && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Import matplotlib the first time to build the font cache.
ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/"

RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \
RUN fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# copying "new default" settings like black code formatter
COPY data/user-settings /home/${NB_USER}/.jupyter/lab/user-settings

USER ${NB_UID}

WORKDIR "${HOME}"

0 comments on commit c3b687a

Please sign in to comment.