Skip to content

Commit

Permalink
Add build and run instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpiper committed Aug 29, 2024
1 parent e559106 commit f4c6f60
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
# bmi-example-c-docker
The C BMI example, Dockerized

The [C example](https://github.com/csdms/bmi-example-c)
for the [Basic Model Interface](https://bmi.readthedocs.io),
dockerized.

## Build an image

Build this example locally with:
```
docker build --tag bmi-example-c .
```
The image is built on the [condaforge/mambaforge](https://hub.docker.com/r/condaforge/mambaforge) base image.
The OS is Linux/Ubuntu.
`conda` and `mamba` are installed in `CONDA_DIR=/opt/conda`.
The *base* environment is activated,
and the C BMI example, including the `run_bmiheatc` executable, is installed into it.

## Run a container

Run a container from this image interactively:
```
docker run -it bmi-example-c
```
This starts a bash shell in the container.
Run the example program `run_bmiheatc` with a configuration file:
```bash
cd /tmp
echo "1.5, 8.0, 6, 5" > config.txt
run_bmiheatc config.txt
```
View the program's output with:
```bash
cat bmiheatc.out
```

## Developer notes

A versioned, multiplatform image built from this repository is hosted on Docker Hub
at [csdms/bmi-example-c](https://hub.docker.com/repository/docker/csdms/bmi-example-c-docker/).
To tag, build, and push an update, run:
```
docker buildx build --platform linux/amd64,linux/arm64 -t csdms/bmi-example-c:<tagname> --push .
```
where `<tagname>` is, e.g., `0.1` or `latest`.

A user can pull this image from Docker Hub with:
```
docker pull csdms/bmi-example-c
```

0 comments on commit f4c6f60

Please sign in to comment.