Skip to content

Commit 481bafb

Browse files
authored
Make the base & minimal notebook containers not amd specific (e.g. support building for arm64) (#1368)
* Dynamically select the right miniforge arch and unpin the ROOT_CONTAINER so that buildx can build arm64 and amd64 cleanup * Remove the commented out hard set of arch * Address code review comments from mathbunnyru * Add setting the owner to respective dockerhbub username * Revert "Add setting the owner to respective dockerhbub username" This reverts commit a8d9c46. * Fix up the dockerfile, make the default buildx compatible with the CI and add a comment about how to do cross-platform builds. * Update the docs * Refactor the Makefile to support cross-building images incrementally, add ARG OWNER to the Dockerfile's so people can more easily push to their own, add docker buildx & ARM64 support to the CI * Simplify build-test-all rule * Match patch version * Run prettier on docker.yml * Declare and export seperately per docker lint * Skip CI changes * Revert the makefile changes * Update the Arch comment to match * back out unrelated changes
1 parent 015b0f8 commit 481bafb

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,7 @@ This change is tracked in the issue [#1217](https://github.com/jupyter/docker-st
104104
- [Jupyter Discourse Forum](https://discourse.jupyter.org/)
105105
- [Jupyter Website](https://jupyter.org)
106106
- [Images on DockerHub](https://hub.docker.com/u/jupyter)
107+
108+
## Architectures
109+
110+
Currently published containers only support x86, some containers may support cross-building with docker buildx.

base-notebook/Dockerfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
# Ubuntu 20.04 (focal)
55
# https://hub.docker.com/_/ubuntu/?tab=tags&name=focal
6-
# OS/ARCH: linux/amd64
7-
ARG ROOT_CONTAINER=ubuntu:focal-20210609@sha256:376209074d481dca0a9cf4282710cd30a9e7ff402dea8261acdaaf57a18971dd
6+
ARG ROOT_CONTAINER=ubuntu:focal-20210609
87

9-
ARG BASE_CONTAINER=$ROOT_CONTAINER
10-
FROM $BASE_CONTAINER
8+
FROM $ROOT_CONTAINER
119

1210
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
1311
ARG NB_USER="jovyan"
@@ -27,19 +25,13 @@ USER root
2725
ARG conda_version="4.10.2"
2826
# Miniforge installer patch version
2927
ARG miniforge_patch_number="0"
30-
# Miniforge installer architecture
31-
ARG miniforge_arch="x86_64"
3228
# Package Manager and Python implementation to use (https://github.com/conda-forge/miniforge)
3329
# - conda only: either Miniforge3 to use Python or Miniforge-pypy3 to use PyPy
3430
# - conda + mamba: either Mambaforge to use Python or Mambaforge-pypy3 to use PyPy
3531
ARG miniforge_python="Mambaforge"
36-
3732
# Miniforge archive to install
3833
ARG miniforge_version="${conda_version}-${miniforge_patch_number}"
39-
# Miniforge installer
40-
ARG miniforge_installer="${miniforge_python}-${miniforge_version}-Linux-${miniforge_arch}.sh"
41-
# Miniforge checksum
42-
ARG miniforge_checksum="1e89ee86afa06e23b2478579be16a33fff6cff346314f6a6382fd20b1f83e669"
34+
4335

4436
# Install all OS dependencies for notebook server that starts but lacks all
4537
# features (e.g., download as all possible file formats)
@@ -104,8 +96,16 @@ RUN mkdir "/home/${NB_USER}/work" && \
10496
WORKDIR /tmp
10597

10698
# Prerequisites installation: conda, mamba, pip, tini
107-
RUN wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${miniforge_version}/${miniforge_installer}" && \
108-
echo "${miniforge_checksum} *${miniforge_installer}" | sha256sum --check && \
99+
RUN set -x && \
100+
# Miniforge installer
101+
miniforge_arch=$(uname -m) && \
102+
export miniforge_arch && \
103+
if [ "$miniforge_arch" == "aarm64" ]; then \
104+
miniforge_arch="arm64"; \
105+
fi; \
106+
miniforge_installer="${miniforge_python}-${miniforge_version}-Linux-${miniforge_arch}.sh" && \
107+
export miniforge_installer && \
108+
wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${miniforge_version}/${miniforge_installer}" && \
109109
/bin/bash "${miniforge_installer}" -f -b -p "${CONDA_DIR}" && \
110110
rm "${miniforge_installer}" && \
111111
# Conda configuration see https://conda.io/projects/conda/en/latest/configuration.html

docs/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Docker destroys the container after notebook server exit, but any files written
4444

4545
docker run --rm -p 10000:8888 -e JUPYTER_ENABLE_LAB=yes -v "${PWD}":/home/jovyan/work jupyter/datascience-notebook:33add21fab64
4646

47+
Architectures
48+
-----------
49+
Currently published containers only support x86, some containers may support cross-building with docker buildx.
50+
51+
4752
Table of Contents
4853
-----------------
4954

0 commit comments

Comments
 (0)