Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
40 changes: 40 additions & 0 deletions .github/workflows/pychaste-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pychaste-docker

on:
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and load
uses: docker/build-push-action@v5
with:
context: ./infra/docker/
pull: true
load: true
tags: chaste/pychaste:latest

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./infra/docker/
pull: true
push: true
tags: chaste/pychaste:latest
29 changes: 17 additions & 12 deletions infra/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 boost-cpp=1.74 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
34 changes: 10 additions & 24 deletions infra/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,31 @@
# 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 <image_id> jmsgrogan/pychaste:latest
[sudo] docker tag <image_id> chaste/pychaste:latest
docker login
docker push jmsgrogan/pychaste
docker push chaste/pychaste:latest
```

## 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
[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.