Skip to content

Commit

Permalink
Doc: Instructions for AMICI with singularity (#1964)
Browse files Browse the repository at this point in the history
* how to create a container
* make Dockerfile compatible with spython/singularity
* mv docker/ container/
  • Loading branch information
dweindl authored Jan 30, 2023
1 parent 672f88d commit 12718e6
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy_protected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- release**
pull_request:
paths:
- docker/Dockerfile
- container/Dockerfile
workflow_dispatch:

jobs:
Expand All @@ -27,7 +27,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- run: git archive -o docker/amici.tar.gz --format=tar.gz HEAD
- run: git archive -o container/amici.tar.gz --format=tar.gz HEAD
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -38,7 +38,7 @@ jobs:
name: dweindl/amici
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: docker/
workdir: container/
dockerfile: Dockerfile
tag_names: true
platforms: linux/amd64,linux/arm64
25 changes: 25 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:22.04

# install dependencies

RUN apt-get update && apt-get install -y \
g++ \
libatlas-base-dev \
python-is-python3 \
python3 \
python3-dev \
python3-pip \
python3-venv \
swig

# prepare python install

COPY amici.tar.gz /from_host/

RUN pip3 install --upgrade pip build && \
mkdir -p /from_host/amici/ && \
cd /from_host/amici && \
tar -xzf ../amici.tar.gz && cd python/sdist && \
python3 -m build --sdist && \
pip3 install -v $(ls -t dist/amici-*.tar.gz | head -1)[petab] && \
rm -rf /from_host
51 changes: 51 additions & 0 deletions container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Using AMICI inside containers

AMICI docker images are regularly published to
https://hub.docker.com/r/dweindl/amici.

## Docker / Podman

The commands below are for use with Docker. When using Podman, just replace
`docker` by `podman`.

### Create an image

In the AMICI base directory run:

```bash
git archive -o container/amici.tar.gz --format=tar.gz HEAD
cd container && docker build -t $USER/amici:latest .
```
Note that this will include files from the last commit, but no uncommitted
changes.

### Pull published image

```bash
docker pull dweindl/amici:latest
```

## Singularity / Apptainer

### Create an image

In the AMICI base directory run:

```bash
# prepare amici files to be copied to the image
# Note that this will include files from the last commit, but no uncommitted
# changes.
git archive -o container/amici.tar.gz --format=tar.gz HEAD
# install spython if necessary
test -x "$(command -v spython)" || pip install spython
# convert Dockerfile to singularity/apptainer definition using spython
(cd container/ && spython recipe Dockerfile amici.def)
# build image
(cd container/ && singularity build amici.sif amici.def)
```

### Pull published image

```bash
singularity pull docker://dweindl/amici:latest
```
24 changes: 0 additions & 24 deletions docker/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions docker/README.md

This file was deleted.

0 comments on commit 12718e6

Please sign in to comment.