-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from Chaste/docker
Update PyChaste Docker Image
- Loading branch information
Showing
3 changed files
with
67 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|