From 644b62cde4e086315bad035ea47b749e14990879 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Tue, 12 Sep 2023 15:07:26 +0100 Subject: [PATCH 01/10] Add Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3535cded --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM jupyter/scipy-notebook + +RUN mamba install -c pychaste -c conda-forge -c bioconda chaste From b071daf5786f2f9bf58fdcf159269dacf1490217 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Wed, 20 Sep 2023 14:07:02 +0100 Subject: [PATCH 02/10] Add notes --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 3535cded..09945aae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,7 @@ FROM jupyter/scipy-notebook RUN mamba install -c pychaste -c conda-forge -c bioconda chaste + +# # Python 3.10 is currently required +# RUN mamba create -n pychaste_env -c pychaste -c conda-forge -c bioconda chaste +# RUN conda activate pychaste_env From c7076c01e087a862c46dddd6b47a68a3813d71c2 Mon Sep 17 00:00:00 2001 From: Ben Evans Date: Thu, 30 Nov 2023 13:25:47 +0000 Subject: [PATCH 03/10] Tidy Dockerfile --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 09945aae..3535cded 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,3 @@ FROM jupyter/scipy-notebook RUN mamba install -c pychaste -c conda-forge -c bioconda chaste - -# # Python 3.10 is currently required -# RUN mamba create -n pychaste_env -c pychaste -c conda-forge -c bioconda chaste -# RUN conda activate pychaste_env From 804c33721bfd53ae4363992c896528dfa7a603c7 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 16:07:29 +0000 Subject: [PATCH 04/10] Switching to micromamba image --- Dockerfile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3535cded..672b68b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,20 @@ -FROM jupyter/scipy-notebook +FROM mambaorg/micromamba:1.5-jammy -RUN mamba install -c pychaste -c conda-forge -c bioconda chaste +USER ROOT +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libgl1-mesa-dev \ + libxt-dev \ + xvfb && \ + apt-get -y clean && \ + rm -rf /var/cache/apt && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/tmp/* && \ + rm -rf /tmp/* + +USER $MAMBA_USER +RUN micromamba install -y -n base -c pychaste -c conda-forge -c bioconda chaste notebook && \ + micromamba clean --all --yes && \ + rm -rf /opt/conda/pkgs/* + +CMD xvfb-run --server-args="-screen 0 1024x768x24" jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 From 4f0bcbb1b05987317792a4a391796a5da176f933 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 16:19:50 +0000 Subject: [PATCH 05/10] Fix Dockerfile user --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 672b68b9..a17e4ac9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM mambaorg/micromamba:1.5-jammy -USER ROOT +USER root RUN apt-get update && \ apt-get install -y --no-install-recommends \ libgl1-mesa-dev \ @@ -14,7 +14,7 @@ RUN apt-get update && \ USER $MAMBA_USER RUN micromamba install -y -n base -c pychaste -c conda-forge -c bioconda chaste notebook && \ - micromamba clean --all --yes && \ - rm -rf /opt/conda/pkgs/* + micromamba clean --all --yes && \ + rm -rf /opt/conda/pkgs/* CMD xvfb-run --server-args="-screen 0 1024x768x24" jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 From 9d3b00870c5644cd4d76e972bb1199a1f089d51a Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 16:27:41 +0000 Subject: [PATCH 06/10] Move Dockerfile to infra --- Dockerfile | 20 -------------------- infra/docker/Dockerfile | 29 +++++++++++++++++------------ infra/docker/README.md | 30 ++++++++---------------------- 3 files changed, 25 insertions(+), 54 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a17e4ac9..00000000 --- a/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM mambaorg/micromamba:1.5-jammy - -USER root -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - libgl1-mesa-dev \ - libxt-dev \ - xvfb && \ - apt-get -y clean && \ - rm -rf /var/cache/apt && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /var/tmp/* && \ - rm -rf /tmp/* - -USER $MAMBA_USER -RUN micromamba install -y -n base -c pychaste -c conda-forge -c bioconda chaste notebook && \ - micromamba clean --all --yes && \ - rm -rf /opt/conda/pkgs/* - -CMD xvfb-run --server-args="-screen 0 1024x768x24" jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 diff --git a/infra/docker/Dockerfile b/infra/docker/Dockerfile index 485850d2..a17e4ac9 100644 --- a/infra/docker/Dockerfile +++ b/infra/docker/Dockerfile @@ -1,15 +1,20 @@ - FROM continuumio/miniconda - RUN apt-get install build-essential lsb-release libgl1-mesa-dev:amd64 libxt-dev:amd64 libatlas-base-dev xvfb -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - RUN conda config --add channels conda-forge && conda config --add channels jmsgrogan - RUN conda install chaste && conda install libgcc --force && conda clean --yes --all && rm -rf /opt/conda/pkgs/* - #RUN conda install vtk jupyter && conda install libgcc && conda clean --yes --all && rm -rf /opt/conda/pkgs/* +FROM mambaorg/micromamba:1.5-jammy - # Add Tini. Tini operates as a process subreaper for jupyter. This prevents - # kernel crashes. - ENV TINI_VERSION v0.6.0 - ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini - RUN chmod +x /usr/bin/tini +USER root +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libgl1-mesa-dev \ + libxt-dev \ + xvfb && \ + apt-get -y clean && \ + rm -rf /var/cache/apt && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/tmp/* && \ + rm -rf /tmp/* - ENTRYPOINT ["/usr/bin/tini", "--"] +USER $MAMBA_USER +RUN micromamba install -y -n base -c pychaste -c conda-forge -c bioconda chaste notebook && \ + micromamba clean --all --yes && \ + rm -rf /opt/conda/pkgs/* - CMD xvfb-run --server-args="-screen 0 1024x768x24" jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 +CMD xvfb-run --server-args="-screen 0 1024x768x24" jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 diff --git a/infra/docker/README.md b/infra/docker/README.md index 55298e47..224fb806 100644 --- a/infra/docker/README.md +++ b/infra/docker/README.md @@ -1,41 +1,27 @@ -# How to build the docker container +# How to build the docker image -The `pychaste` docker container is on the channel `jmsgrogan` on the Docker Hub. This directory contains the Dockerfile for setting up the container. Assuming Docker is set up, it can be built by doing: +The `pychaste` docker image is on the channel `chaste` on the Docker Hub. This directory contains the Dockerfile for building the image. Assuming [Docker](https://www.docker.com) is set up, it can be built by running: ```bash [sudo] docker build -t pychaste . ``` -If you are happy with the package it can be tagged and uploaded. Do: +If you are happy with the package it can be tagged and uploaded to Docker Hub. +To find the image id, run: ```bash [sudo] docker images ``` -to find the image id. Then do: +To tag the image with the `latest` tag and upload it to Docker Hub: ```bash -[sudo] docker tag jmsgrogan/pychaste:latest +[sudo] docker tag chaste/pychaste:latest docker login -docker push jmsgrogan/pychaste +docker push chaste/pychaste ``` -## Preparing docker for the build - -To set up docker for the build do: - -```bash -sudo apt-get update -sudo apt-get install apt-transport-https ca-certificates -sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D -echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list -sudo apt-get update -sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtuals -sudo apt-get install docker-engine -sudo service docker start -``` - -## Working with the package +## Working with the local image ```bash [sudo] docker run -it -p 8888:8888 pychaste From 42c6d2302157ff850643be62173d1e5ce93be5bb Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 16:30:34 +0000 Subject: [PATCH 07/10] Update Docker README --init for tini --- infra/docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/docker/README.md b/infra/docker/README.md index 224fb806..f19d0a50 100644 --- a/infra/docker/README.md +++ b/infra/docker/README.md @@ -24,7 +24,7 @@ docker push chaste/pychaste ## Working with the local image ```bash -[sudo] docker run -it -p 8888:8888 pychaste +[sudo] docker run --init -it -p 8888:8888 pychaste ``` Then go to [htpp://localhost::8888](htpp://localhost::8888) in a web browser. From e959b47a5506c04fb643232b8744adfa169f0c1a Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 16:38:34 +0000 Subject: [PATCH 08/10] Add pychaste-docker build workflow --- .github/workflows/pychaste-docker.yml | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/pychaste-docker.yml diff --git a/.github/workflows/pychaste-docker.yml b/.github/workflows/pychaste-docker.yml new file mode 100644 index 00000000..972172c3 --- /dev/null +++ b/.github/workflows/pychaste-docker.yml @@ -0,0 +1,40 @@ +name: pychaste-docker + +on: + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and export to Docker + uses: docker/build-push-action@v4 + with: + context: . + pull: true + load: true + tags: latest + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + pull: true + push: true + tags: latest \ No newline at end of file From c46cbf3169c9cdf9206239bc17e3eff2dec432e9 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 16:52:38 +0000 Subject: [PATCH 09/10] Update pychaste-docker workflow --- .github/workflows/pychaste-docker.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pychaste-docker.yml b/.github/workflows/pychaste-docker.yml index 972172c3..927426e5 100644 --- a/.github/workflows/pychaste-docker.yml +++ b/.github/workflows/pychaste-docker.yml @@ -9,32 +9,32 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and export to Docker - uses: docker/build-push-action@v4 + - name: Build and load + uses: docker/build-push-action@v5 with: - context: . + context: ./infra/docker/ pull: true load: true - tags: latest + tags: chaste/pychaste:latest - name: Build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - context: . + context: ./infra/docker/ pull: true push: true - tags: latest \ No newline at end of file + tags: chaste/pychaste:latest \ No newline at end of file From 57a6260d2da9000a755a286a8d90a61915250d40 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 8 Jan 2024 18:30:35 +0000 Subject: [PATCH 10/10] Fix Docker boost version --- infra/docker/Dockerfile | 2 +- infra/docker/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/infra/docker/Dockerfile b/infra/docker/Dockerfile index a17e4ac9..0c6b7a40 100644 --- a/infra/docker/Dockerfile +++ b/infra/docker/Dockerfile @@ -13,7 +13,7 @@ RUN apt-get update && \ rm -rf /tmp/* USER $MAMBA_USER -RUN micromamba install -y -n base -c pychaste -c conda-forge -c bioconda chaste notebook && \ +RUN micromamba install -y -n base -c pychaste -c conda-forge -c bioconda chaste boost-cpp=1.74 notebook && \ micromamba clean --all --yes && \ rm -rf /opt/conda/pkgs/* diff --git a/infra/docker/README.md b/infra/docker/README.md index f19d0a50..dfa0b0dc 100644 --- a/infra/docker/README.md +++ b/infra/docker/README.md @@ -18,7 +18,7 @@ To tag the image with the `latest` tag and upload it to Docker Hub: ```bash [sudo] docker tag chaste/pychaste:latest docker login -docker push chaste/pychaste +docker push chaste/pychaste:latest ``` ## Working with the local image @@ -27,5 +27,5 @@ docker push chaste/pychaste [sudo] docker run --init -it -p 8888:8888 pychaste ``` -Then go to [htpp://localhost::8888](htpp://localhost::8888) in a web browser. +Then go to [http://localhost::8888](http://localhost::8888) in a web browser.