This PR is a proof-of-concept for a CI build of a Docker image on GitHub. It is has three parts:
A Dockerfile for the build
A GitHub workflow description .github/workflows/main.yaml for continuous integration
A docker-compose.yml file to run a container
Build
The Dockerfile describes the build of an image. After downloading a base image of Alpine Linux and all required dependencies incl. exprtk, the C++ build is started and the tests are run. When that succeeds, the binaries are taken over into a new small image that only includes the runtime dependencies.
Continuous Integration
Whenever a commit is reaching branch feature/ci, a workflow is started via GitHub Actions. The workflow creates a Docker image for five platforms in parallel (multi-arch). When the build of an image succeeds, the image is pushed to the GitHub Container Registry. The image name is derived from the Git repository. When all builds succeed, a manifest list is created for the branch, so that the same image name may be used on any platform, e.g. ghcr.io/BlackZork/mqmgateway:feature-ci. The images are shown in GitHub on the right side of the repository in section Packages.
Runtime
The docker-compose.yml is the only file that a user requires to run the application, apart from a configuration file config.yaml expected in the same directory. The devices for Modbus RTU may be configured in the compose file. The application can be managed and monitored with standard compose commands, e.g. docker compose up to start or docker compose logs to view the logs.
Notes
This configuration is meant as starting point. It was tested in my repository where everything may be inspected, e.g.
This PR is a proof-of-concept for a CI build of a Docker image on GitHub. It is has three parts:
Dockerfile
for the build.github/workflows/main.yaml
for continuous integrationdocker-compose.yml
file to run a containerBuild
The
Dockerfile
describes the build of an image. After downloading a base image of Alpine Linux and all required dependencies incl. exprtk, the C++ build is started and the tests are run. When that succeeds, the binaries are taken over into a new small image that only includes the runtime dependencies.Continuous Integration
Whenever a commit is reaching branch
feature/ci
, a workflow is started via GitHub Actions. The workflow creates a Docker image for five platforms in parallel (multi-arch). When the build of an image succeeds, the image is pushed to the GitHub Container Registry. The image name is derived from the Git repository. When all builds succeed, a manifest list is created for the branch, so that the same image name may be used on any platform, e.g.ghcr.io/BlackZork/mqmgateway:feature-ci
. The images are shown in GitHub on the right side of the repository in section Packages.Runtime
The
docker-compose.yml
is the only file that a user requires to run the application, apart from a configuration fileconfig.yaml
expected in the same directory. The devices for Modbus RTU may be configured in the compose file. The application can be managed and monitored with standard compose commands, e.g.docker compose up
to start ordocker compose logs
to view the logs.Notes
feature/ci
, but I can only select existing branches as target. Thus I marked this PR as Draft.master
and misses the changed offix/i386
.fix/i386
and succeeds.