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

Add support for cross-building for ARM #166

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
- docker

script:
- docker-compose build
- DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose build

deploy:
- provider: script
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ It should output something like this:
{'tcp://172.23.0.4:41269': 4}
```

### Cross building

The images can be cross-built using docker buildx, e.g.

```
# If you have permission to push to daskdev/
docker buildx bake --progress=plain --set *.platform=linux/arm64,linux/amd64 --push
# If you don't
export DOCKERUSER=holdenk
docker buildx bake --progress=plain --set *.platform=linux/arm64,linux/amd64 --set scheduler.tags=${DOCKERUSER}/dask --set worker.tags=${DOCKERUSER}/dask --set notebook.tags=${DOCKERUSER}/dask --push
```

## Environment Variables

The following environment variables are supported for both the base and notebook images:
Expand Down
17 changes: 10 additions & 7 deletions base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM continuumio/miniconda3:4.8.2
FROM condaforge/miniforge3:4.10.3-2

RUN conda install --yes \
-c conda-forge \
python==3.8 \
python-blosc \
SHELL ["/bin/bash", "-c"]

ENV PATH /opt/conda/bin:$PATH

RUN conda install --yes nomkl cytoolz cmake \
&& conda install --yes mamba \
&& mamba install --yes python==3.8.6 \
jacobtomlinson marked this conversation as resolved.
Show resolved Hide resolved
&& mamba install --yes \
cytoolz \
dask==2021.7.0 \
lz4 \
nomkl \
numpy==1.21.1 \
pandas==1.3.0 \
tini==0.18.0 \
&& conda clean -tipsy \
&& mamba clean -tipsy \
&& find /opt/conda/ -type f,l -name '*.a' -delete \
&& find /opt/conda/ -type f,l -name '*.pyc' -delete \
&& find /opt/conda/ -type f,l -name '*.js.map' -delete \
Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,11 @@ services:
hostname: dask-worker
command: ["dask-worker", "tcp://scheduler:8786"]

base-notebook:
build:
context: github.com/jupyter/docker-stacks.git#master:base-notebook
dockerfile: Dockerfile
args:
PYTHON_VERSION: "3.8"
image: jupyter/base-notebook:lab
holdenk marked this conversation as resolved.
Show resolved Hide resolved

notebook:
build:
context: ./notebook
dockerfile: Dockerfile
image: daskdev/dask-notebook
depends_on:
- base-notebook
hostname: notebook
ports:
- "8888:8888"
Expand Down
17 changes: 9 additions & 8 deletions notebook/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM jupyter/base-notebook:lab-3.0.5
FROM jupyter/base-notebook:python-3.9.6
holdenk marked this conversation as resolved.
Show resolved Hide resolved

USER root

Expand All @@ -7,34 +7,35 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" && \
# We don't use TARGETARCH so as to support non-buildkit builds
RUN MAGICARCH=$(dpkg --print-architecture) && \
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${MAGICARCH}/kubectl" && \
mkdir -p /usr/local/bin && \
mv ./kubectl /usr/local/bin/kubectl && \
chmod +x /usr/local/bin/kubectl && \
kubectl version --client

USER $NB_USER

RUN conda install --yes \
-c conda-forge \
RUN conda install -c conda-forge --yes mamba \
&& mamba install --yes python==3.8.6 nomkl \
&& mamba install --yes \
python-blosc \
cytoolz \
dask==2021.7.0 \
lz4 \
nomkl \
numpy==1.21.1 \
pandas==1.3.0 \
ipywidgets \
dask-labextension>=5 \
python-graphviz \
&& conda clean -tipsy \
&& mamba clean -tipsy \
&& jupyter lab clean \
&& jlpm cache clean \
&& npm cache clean --force \
&& find /opt/conda/ -type f,l -name '*.a' -delete \
&& find /opt/conda/ -type f,l -name '*.pyc' -delete \
&& find /opt/conda/ -type f,l -name '*.js.map' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -type f,l -name '*.js' -not -name '*.min.js' -delete \
&& find /opt/conda/lib/python*/site-packages/bokeh/server/static -type f,l -name '*.js' -not -name '*.min.js' -delete || echo "no bokeh static files to cleanup" \
&& rm -rf /opt/conda/pkgs

USER root
Expand Down
7 changes: 3 additions & 4 deletions notebook/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -x
if [ $UID -eq 0 ]; then
# We start by adding extra apt packages, since pip modules may require system dependencies
if [ "$EXTRA_APT_PACKAGES" ]; then
echo "EXTRA_APT_PACKAGES environment variable found. Installing."
apt update -y
apt install -y $EXTRA_APT_PACKAGES
echo "EXTRA_APT_PACKAGES environment variable found. Installing."
apt update -y
apt install -y $EXTRA_APT_PACKAGES
fi
# Start the script over again, this time as a non-root user.
exec sudo -E --user "$NB_USER" PATH="$PATH" "$0" -- "$@"
Expand All @@ -33,4 +33,3 @@ fi


exec start.sh jupyter lab ${JUPYTERLAB_ARGS}