-
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
51 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,52 @@ | ||
# bmi-example-cxx-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 the image | ||
|
||
Build this example locally with: | ||
``` | ||
docker build --tag bmi-example-cxx . | ||
``` | ||
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 `CONDA_DIR=/opt/conda`, | ||
and the *base* environment is activated. | ||
The C++ BMI specification and example, including the `run_bmiheatc` executable, are installed into it. | ||
|
||
## Run a container | ||
|
||
Run a container from this image interactively: | ||
``` | ||
docker run -it bmi-example-cxx | ||
``` | ||
This starts a bash shell in the container. | ||
Run the example program `run_bmiheatcxx` with a configuration file: | ||
```bash | ||
cd /tmp | ||
echo "1.5, 8.0, 6, 5" > config.txt | ||
run_bmiheatcxx config.txt | ||
``` | ||
View the program's output with: | ||
```bash | ||
cat bmiheatcxx.out | ||
``` | ||
|
||
## Developer notes | ||
|
||
A versioned, multiplatform image built from this repository is hosted on Docker Hub | ||
at [csdms/bmi-example-cxx](https://hub.docker.com/r/csdms/bmi-example-cxx/). | ||
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-cxx:latest --push . | ||
``` | ||
A user can pull this image from Docker Hub with: | ||
``` | ||
docker pull csdms/bmi-example-cxx | ||
``` | ||
optionally with the `latest` tag or with a version tag. |