-
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.
- Loading branch information
Showing
1 changed file
with
49 additions
and
1 deletion.
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 |
---|---|---|
@@ -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 | ||
``` |