From 1fabd9a4fcbc71ee14e0adb417720dda7da7a938 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Mon, 2 Sep 2024 11:57:37 -0600 Subject: [PATCH] Rebuild from bmi base image --- Dockerfile | 15 ++++++++++----- README.md | 23 ++++++++++++++--------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2482bcf..c35e193 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,18 @@ # Build the Python BMI example from a Mambaforge (Linux/Ubuntu) image. -FROM condaforge/mambaforge:24.3.0-0 +FROM csdms/bmi:0.1.0 LABEL author="Mark Piper" LABEL email="mark.piper@colorado.edu" -ENV prefix=/opt/bmi-example-python +ENV base_url=https://github.com/csdms +ENV package=bmi-example-python ENV version="2.1.2" +ENV prefix=/opt/${package} -RUN git clone --branch v${version} https://github.com/csdms/bmi-example-python ${prefix} +RUN git clone --branch v${version} ${base_url}/${package} ${prefix} WORKDIR ${prefix} -RUN mamba install -y --file requirements.txt -RUN pip install . +RUN mamba install -y --file requirements.txt --file requirements-testing.txt +RUN pip install .[testing] +RUN pytest + +WORKDIR /opt diff --git a/README.md b/README.md index f85b492..b611c55 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,17 @@ The [Python example](https://github.com/csdms/bmi-example-python) for the [Basic Model Interface](https://bmi.readthedocs.io), dockerized. -## Build an image +## Build the image Build this example locally with: ``` docker build --tag bmi-example-python . ``` -The image is built on the [condaforge/mambaforge](https://hub.docker.com/r/condaforge/mambaforge) base image. +The image is based on the [csdms/bmi](https://hub.docker.com/r/csdms/bmi) image. The OS is Linux/Ubuntu. -`conda` and `mamba` are installed in `opt/conda`. -The *base* environment is activated, -and the Python BMI example is installed into it. +`conda` and `mamba` are installed in `CONDA_DIR=opt/conda`, +and the *base* environment is activated. +The Python BMI specification and example are installed into it. ## Run a container @@ -51,11 +51,16 @@ Copy/paste this URL into a browser to view and run the example notebooks. ## Developer notes A versioned, multiplatform image built from this repository is hosted on Docker Hub -at [csdms/bmi-example-python](https://hub.docker.com/repository/docker/csdms/bmi-example-python/). -This image is automatically built and pushed to Docker Hub -with the [release](./.github/workflows/release.yml) CI workflow. -The workflow is only run when the repository is tagged. +at [csdms/bmi-example-python](https://hub.docker.com/r/csdms/bmi-example-python/). +When this repository is tagged, +an image is automatically built and pushed to Docker Hub +by the [release](./.github/workflows/release.yml) CI workflow. +To manually build and push an update, run: +``` +docker buildx build --platform linux/amd64,linux/arm64 -t csdms/bmi-example-python:latest --push . +``` A user can pull this image from Docker Hub with: ``` docker pull csdms/bmi-example-python ``` +optionally with the `latest` tag or with a version tag.