Docker images are used to build, package, and test srcML on Linux. A Docker Compose file, compose.yml, is in the root directory and manages docker image management (build, push, pull) and execution on all the Linux distributions for packaging. The Dockerfiles are in the directory docker with a subdirectory for each platform.
All docker-compose commands are entered in the root directory of the srcML repository. They do not work in the docker subdirectory or the build directory.
The default operation is running the workflow ci-<platform>, which includes building, packaging, and testing the installed package. By default, it runs the cmake workflow ci-package-<installer> where the is deb or rpm. I.e., for Ubuntu, it is equivalent to running the following:
cmake --workflow --preset ci-ubuntuTo build and package srcML on all supported Linux distributions:
docker compose upAll packages are saved to the docker volume srcml_dist. The Docker Desktop lets you view the volume's contents and download individual packages.
There is a lot of control to only build and package for specific distributions or platforms. To build and package srcML on Ubuntu 24.04
docker compose up ubuntu_24.04To build and package srcML for all Ubuntu distributions:
docker compose --profile ubuntu upAll Linux services are organized into Docker Compose profiles. They include a default profile, e.g., package; Linux distributions, e.g., ubuntu, fedora, and opensuse, and age, e.g., latest, earliest.
The default architecture is your host machine's architecture, i.e., linux/amd64 or linux/arm64. To
build on the non-default architecture, set the environment variable PLATFORM. E.g., To build for x86 while on an ARM architecture, you can set the environment variable:
export PLATFORM="linux/amd64"Or, you can run the command with the environment set:
env PLATFORM="linux/amd64" docker compose upThere are some special services to manage the packages.
To list the built packages:
docker compose run lsTo combine all packages into one archive file:
docker compose run tarTo remove all generated packages:
docker compose run cleanThe following commands apply to all Docker images. To selectively do any of the following, see the variations above.
Docker images are automatically pulled when they are not in the local cache. If they are in the local cache, they are not automatically updated. To update docker images:
docker compose pullIf the Dockerfiles change, a new one is added, or a previous one is updated, the image needs to be rebuilt. To build all docker images (after Dockerfile change):
docker compose buildTo push all docker images to Docker Hub (if you have permission):
docker compose push