This is a testing set of Dockerfile for building a Dyninst base container.
For development, we want to be able to:
- Pull a container with dyninst ready to go (for development or dyninst or another library)
- Quickly update with our own source code without needing to build everything.
And for testing, we want to be able to:
- Have a set of base containers that make dependency preparation minimal
- Use those base containers to quickly test a PR's dyninst and report results
These are both achieved using a single workflow based on a set of base images with each containing a minimal OS environment and the package-provided versions of the various Dyninst dependencies. There is no source for Dyninst or any of its components. The development image is a small layer on top of a base and contains the Dyninst source and binaries. They are named by both the base OS and the hardware architecture. For example, the base container for Ubuntu 20.04 on x86_64 is dyninst-amd64-base:ubuntu-20.04. The corresponding development container is named dyninst-amd64:ubuntu-20.04.
The Dockerfiles provided are intended for building the base and development containers from scratch.
A Dockerfile is provided that makes it easy to bring up a development environment. The following builds the Ubuntu 20.04 images.
$ cd path/to/Dyninst/source
# Base image (Ubuntu 20.04 needs a newer elfutils)
$ docker build -f docker/Dockerfile.ubuntu -t dyninst-base:ubuntu-20.04 --build-arg version=20.04 --build-arg build_elfutils=yes .
# Development image
$ docker build -f docker/Dockerfile -t dyninst:ubuntu-20.04 --build-arg build_jobs=16 --build-arg base=dyninst-base:ubuntu-20.04 .Dyninst is installed in /dyninst/install, and its source is in /dyninst/src.
You can then shell inside to interact with dyninst:
$ docker run -it dyninst:ubuntu-20.04 bashFor a more interactive development environment, you can bind the present working directory with the
Dyninst source code bound to /code instead:
$ docker run -it -v $PWD:/code dyninst:ubuntu-20.04And again navigate to the bound source code - this time the files are on your local machine, so you can edit them locally and build in the container!
# This is bound to your host - edit files there
$ cd /codeAssuming all of the requisite CMake files are in place, a new dependency can be added to the container images. If
the dependency can be installed by the package provider, add it to the Dockerfile.<OS> file, and run
build_base_images.sh --push. If it needs to be built from source, add a new build script (e.g., build_foo.sh)
and call it from the Dockerfile.<OS> files. If the dependency only sometimes needs to be built from source,
see the usage of 'build_elfutils.sh' for guidance.