From 0120afd03ecc6ab2fe158aacc34be965fd0b84ac Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 6 May 2021 18:57:52 +0200 Subject: [PATCH 1/2] Remove outdated ppc64le arch support --- Makefile | 19 +--- base-notebook/Dockerfile.ppc64le | 136 ------------------------- base-notebook/Dockerfile.ppc64le.patch | 102 ------------------- 3 files changed, 2 insertions(+), 255 deletions(-) delete mode 100644 base-notebook/Dockerfile.ppc64le delete mode 100644 base-notebook/Dockerfile.ppc64le.patch diff --git a/Makefile b/Makefile index d4efad24..33d42ab1 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,9 @@ # Use bash for inline if-statements in arch_patch target SHELL:=bash -ARCH:=$(shell uname -m) OWNER?=jupyter # Need to list the images in build dependency order -ifeq ($(ARCH),ppc64le) -ALL_IMAGES:=base-notebook -else ALL_IMAGES:=base-notebook \ minimal-notebook \ r-notebook \ @@ -19,7 +15,6 @@ ALL_IMAGES:=base-notebook \ datascience-notebook \ pyspark-notebook \ all-spark-notebook -endif # Enable BuildKit for Docker build export DOCKER_BUILDKIT:=1 @@ -32,24 +27,14 @@ help: @echo @grep -E '^[a-zA-Z0-9_%/-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -arch_patch/%: ## apply hardware architecture specific patches to the Dockerfile - @if [ -e ./$(notdir $@)/Dockerfile.$(ARCH).patch ]; then \ - if [ -e ./$(notdir $@)/Dockerfile.orig ]; then \ - cp -f ./$(notdir $@)/Dockerfile.orig ./$(notdir $@)/Dockerfile; \ - else \ - cp -f ./$(notdir $@)/Dockerfile ./$(notdir $@)/Dockerfile.orig; \ - fi; \ - patch -f ./$(notdir $@)/Dockerfile ./$(notdir $@)/Dockerfile.$(ARCH).patch; \ - fi - build/%: DARGS?= build/%: ## build the latest image for a stack docker build $(DARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):latest ./$(notdir $@) @echo -n "Built image size: " @docker images $(OWNER)/$(notdir $@):latest --format "{{.Size}}" -build-all: $(foreach I,$(ALL_IMAGES),arch_patch/$(I) build/$(I) ) ## build all stacks -build-test-all: $(foreach I,$(ALL_IMAGES),arch_patch/$(I) build/$(I) test/$(I) ) ## build and test all stacks +build-all: $(foreach I,$(ALL_IMAGES), build/$(I) ) ## build all stacks +build-test-all: $(foreach I,$(ALL_IMAGES), build/$(I) test/$(I) ) ## build and test all stacks check-outdated/%: ## check the outdated conda packages in a stack and produce a report (experimental) @TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest test/test_outdated.py diff --git a/base-notebook/Dockerfile.ppc64le b/base-notebook/Dockerfile.ppc64le deleted file mode 100644 index 6320d7d9..00000000 --- a/base-notebook/Dockerfile.ppc64le +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (c) IBM Corporation 2016 -# Distributed under the terms of the Modified BSD License. - -# Ubuntu image -FROM ppc64le/ubuntu:18.04 - -LABEL maintainer="Ilsiyar Gaynutdinov " -ARG NB_USER="jovyan" -ARG NB_UID="1000" -ARG NB_GID="100" - -USER root - -# Install all OS dependencies for notebook server that starts but lacks all -# features (e.g., download as all possible file formats) -ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update \ - && apt-get install -yq --no-install-recommends \ - wget \ - bzip2 \ - ca-certificates \ - sudo \ - locales \ - fonts-liberation \ - run-one \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ - locale-gen - -# Configure environment -ENV CONDA_DIR=/opt/conda \ - SHELL=/bin/bash \ - NB_USER=$NB_USER \ - NB_UID=$NB_UID \ - NB_GID=$NB_GID \ - LC_ALL=en_US.UTF-8 \ - LANG=en_US.UTF-8 \ - LANGUAGE=en_US.UTF-8 -ENV PATH=$CONDA_DIR/bin:$PATH \ - HOME=/home/$NB_USER - -# Copy a script that we will use to correct permissions after running certain commands -COPY fix-permissions /usr/local/bin/fix-permissions -RUN chmod a+rx /usr/local/bin/fix-permissions - -# Enable prompt color in the skeleton .bashrc before creating the default NB_USER -RUN sed -i 's/^#force_color_prompt=yes/force_color_prompt=yes/' /etc/skel/.bashrc - -# Create NB_USER wtih name jovyan user with UID=1000 and in the 'users' group -# and make sure these dirs are writable by the `users` group. -RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \ - sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \ - sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \ - useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \ - mkdir -p $CONDA_DIR && \ - chown $NB_USER:$NB_GID $CONDA_DIR && \ - chmod g+w /etc/passwd && \ - fix-permissions $HOME && \ - fix-permissions $CONDA_DIR - -USER $NB_UID -WORKDIR $HOME -ARG PYTHON_VERSION=default - -# Setup work directory for backward-compatibility -RUN mkdir /home/$NB_USER/work && \ - fix-permissions /home/$NB_USER - -# Install conda as jovyan and check the md5 sum provided on the download site -ENV MINICONDA_VERSION=4.8.2 \ - MINICONDA_MD5=e50662a93f3f5e56ef2d3fdfaf2f8e91 \ - CONDA_VERSION=4.8.2 - -# Install conda as jovyan -RUN cd /tmp && \ - wget --quiet https://repo.continuum.io/miniconda/Miniconda3-py37_${MINICONDA_VERSION}-Linux-ppc64le.sh && \ - echo "${MINICONDA_MD5} *Miniconda3-py37_${MINICONDA_VERSION}-Linux-ppc64le.sh" | md5sum -c - && \ - /bin/bash Miniconda3-py37_${MINICONDA_VERSION}-Linux-ppc64le.sh -f -b -p $CONDA_DIR && \ - rm -rf Miniconda3-py37_${MINICONDA_VERSION}-Linux-ppc64le.sh && \ - echo "conda ${CONDA_VERSION}" >> $CONDA_DIR/conda-meta/pinned && \ - conda config --system --prepend channels conda-forge && \ - conda config --system --set auto_update_conda false && \ - conda config --system --set show_channel_urls true && \ - conda config --system --set channel_priority strict && \ - if [ ! $PYTHON_VERSION = 'default' ]; then conda install --yes python=$PYTHON_VERSION; fi && \ - conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned && \ - conda install --quiet --yes conda && \ - conda install --quiet --yes pip && \ - conda update --all --quiet --yes && \ - conda clean --all -f -y && \ - rm -rf /home/$NB_USER/.cache/yarn && \ - fix-permissions $CONDA_DIR && \ - fix-permissions /home/$NB_USER - -# Install Tini -RUN conda install --quiet --yes 'tini=0.18.0' && \ - conda list tini | grep tini | tr -s ' ' | cut -d ' ' -f 1,2 >> $CONDA_DIR/conda-meta/pinned && \ - conda clean --all -f -y && \ - fix-permissions $CONDA_DIR && \ - fix-permissions /home/$NB_USER - -# Install Jupyter Notebook, Lab, and Hub -# Generate a notebook server config -# Cleanup temporary files -# Correct permissions -# Do all this in a single RUN command to avoid duplicating all of the -# files across image layers when the permissions change -RUN conda install --quiet --yes \ - 'notebook=6.1.3' \ - 'jupyterhub=1.1.0' \ - 'jupyterlab=2.2.5' && \ - conda clean --all -f -y && \ - npm cache clean --force && \ - jupyter notebook --generate-config && \ - rm -rf $CONDA_DIR/share/jupyter/lab/staging && \ - rm -rf /home/$NB_USER/.cache/yarn && \ - fix-permissions $CONDA_DIR && \ - fix-permissions /home/$NB_USER - -EXPOSE 8888 - -# Configure container startup -ENTRYPOINT ["tini", "-g", "--"] -CMD ["start-notebook.sh"] - -# Copy local files as late as possible to avoid cache busting -COPY start.sh start-notebook.sh start-singleuser.sh /usr/local/bin/ -COPY jupyter_notebook_config.py /etc/jupyter/ - -# Fix permissions on /etc/jupyter as root -USER root -RUN fix-permissions /etc/jupyter/ - -# Switch back to jovyan to avoid accidental container runs as root -USER $NB_UID diff --git a/base-notebook/Dockerfile.ppc64le.patch b/base-notebook/Dockerfile.ppc64le.patch deleted file mode 100644 index 9b3e9d0e..00000000 --- a/base-notebook/Dockerfile.ppc64le.patch +++ /dev/null @@ -1,102 +0,0 @@ ---- Dockerfile 2017-05-11 12:59:30.006182756 -0400 -+++ Dockerfile.ppc64le 2017-05-11 12:59:57.326632865 -0400 -@@ -1,37 +1,43 @@ --# Copyright (c) Jupyter Development Team. -+# Copyright (c) IBM Corporation 2016 - # Distributed under the terms of the Modified BSD License. - --# Debian Jessie debootstrap from 2017-02-27 --# https://github.com/docker-library/official-images/commit/aa5973d0c918c70c035ec0746b8acaec3a4d7777 --FROM debian@sha256:52af198afd8c264f1035206ca66a5c48e602afb32dc912ebf9e9478134601ec4 -+# Ubuntu image -+FROM ppc64le/ubuntu:trusty - --MAINTAINER Jupyter Project -+MAINTAINER Ilsiyar Gaynutdinov - - USER root - - # Install all OS dependencies for notebook server that starts but lacks all - # features (e.g., download as all possible file formats) - ENV DEBIAN_FRONTEND noninteractive --RUN REPO=https://cdn-fastly.deb.debian.org \ -- && echo "deb $REPO/debian jessie main\ndeb $REPO/debian-security jessie/updates main" > /etc/apt/sources.list \ -- && apt-get update && apt-get -yq dist-upgrade \ -+RUN apt-get update && apt-get -yq dist-upgrade \ - && apt-get install -yq --no-install-recommends \ -- wget \ -+ build-essential \ - bzip2 \ - ca-certificates \ -- sudo \ -+ cmake \ -+ git \ - locales \ -- && apt-get clean \ -- && rm -rf /var/lib/apt/lists/* -- --RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ -- locale-gen -+ sudo \ -+ wget \ -+ && apt-get clean && \ -+ rm -rf /var/lib/apt/lists/* - --# Install Tini --RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.10.0/tini && \ -- echo "1361527f39190a7338a0b434bd8c88ff7233ce7b9a4876f3315c22fce7eca1b0 *tini" | sha256sum -c - && \ -- mv tini /usr/local/bin/tini && \ -+RUN echo "LANGUAGE=en_US.UTF-8" >> /etc/default/locale -+RUN echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale -+RUN echo "LC_TYPE=en_US.UTF-8" >> /etc/default/locale -+RUN locale-gen en_US en_US.UTF-8 -+ -+#build and install Tini for ppc64le -+RUN wget https://github.com/krallin/tini/archive/v0.10.0.tar.gz && \ -+ tar zxvf v0.10.0.tar.gz && \ -+ rm -rf v0.10.0.tar.gz -+WORKDIR tini-0.10.0/ -+RUN cmake . && make install -+RUN mv ./tini /usr/local/bin/tini && \ - chmod +x /usr/local/bin/tini -+WORKDIR .. - - # Configure environment - ENV CONDA_DIR /opt/conda -@@ -59,25 +65,26 @@ - # Install conda as jovyan - RUN cd /tmp && \ - mkdir -p $CONDA_DIR && \ -- wget --quiet https://repo.continuum.io/miniconda/Miniconda3-4.2.12-Linux-x86_64.sh && \ -- echo "c59b3dd3cad550ac7596e0d599b91e75d88826db132e4146030ef471bb434e9a *Miniconda3-4.2.12-Linux-x86_64.sh" | sha256sum -c - && \ -- /bin/bash Miniconda3-4.2.12-Linux-x86_64.sh -f -b -p $CONDA_DIR && \ -- rm Miniconda3-4.2.12-Linux-x86_64.sh && \ -+ wget https://repo.continuum.io/miniconda/Miniconda3-4.2.12-Linux-ppc64le.sh && \ -+ /bin/bash Miniconda3-4.2.12-Linux-ppc64le.sh -f -b -p $CONDA_DIR && \ -+ rm -rf Miniconda3-4.2.12-Linux-ppc64le.sh && \ -+ $CONDA_DIR/bin/conda install --quiet --yes conda=4.2.12 && \ - $CONDA_DIR/bin/conda config --system --add channels conda-forge && \ - $CONDA_DIR/bin/conda config --system --set auto_update_conda false && \ - conda clean --all -f -y - --# Install Jupyter Notebook and Hub --RUN conda install --quiet --yes \ -- 'notebook=5.2.*' \ -- 'jupyterhub=0.7.*' \ -- 'jupyterlab=0.18.*' \ -- && conda clean --all -f -y -+# Install Jupyter notebook and Hub -+RUN yes | pip install --upgrade pip -+RUN yes | pip install --quiet --no-cache-dir \ -+ 'notebook==5.2.*' \ -+ 'jupyterhub==0.7.*' \ -+ 'jupyterlab==0.18.*' - - USER root - - EXPOSE 8888 - WORKDIR /home/$NB_USER/work -+RUN echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers - - # Configure container startup - ENTRYPOINT ["tini", "--"] From eabfdfe005ebd014fadf060aa91602f91a90ea21 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 6 May 2021 19:14:55 +0200 Subject: [PATCH 2/2] Apply suggestion from code review --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e14108f1..7c480d85 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: - id: hadolint-docker # FIXME: remove after https://github.com/hadolint/hadolint/issues/628 is resolved entry: hadolint/hadolint:v2.3.0 hadolint - exclude: Dockerfile.ppc64le|Dockerfile.ppc64le.patch - repo: https://github.com/adrienverge/yamllint.git rev: v1.26.1 hooks: