|
| 1 | +## Ubuntu: A Docker image used to build and test rippled |
| 2 | + |
| 3 | +The code in this repository creates a locked-down Ubuntu image for building and |
| 4 | +testing rippled in the GitHub CI pipelines. |
| 5 | + |
| 6 | +### Logging into the Docker registry |
| 7 | + |
| 8 | +To be able to push to GitHub a personal access token is needed, see instructions |
| 9 | +[here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic). |
| 10 | +In summary, if you do not have a suitable personal access token, generate one |
| 11 | +[here](https://github.com/settings/tokens/new?scopes=write:packages). |
| 12 | + |
| 13 | +```shell |
| 14 | +DOCKER_REGISTRY=ghcr.io |
| 15 | +GITHUB_USER=<your-github-username> |
| 16 | +GITHUB_TOKEN=<your-github-personal-access-token> |
| 17 | +echo ${GITHUB_TOKEN} | \ |
| 18 | +docker login ${DOCKER_REGISTRY} -u "${GITHUB_USER}" --password-stdin |
| 19 | +``` |
| 20 | + |
| 21 | +### Building and pushing the Docker image |
| 22 | + |
| 23 | +The same Dockerfile can be used to build an image for Ubuntu 22.04 and 24.04 by |
| 24 | +specifying the `UBUNTU_VERSION` build argument. There are additional arguments |
| 25 | +to specify as well, namely `CMAKE_VERSION` and `GCC_VERSION` for the GCC flavor |
| 26 | +and `CMAKE_VERSION` and `CLANG_VERSION` for the Clang flavor. |
| 27 | + |
| 28 | +Run the commands below from the current directory containing the Dockerfile. |
| 29 | + |
| 30 | +#### Building the Docker image for GCC. |
| 31 | + |
| 32 | +Ensure you've run the login command above to authenticate with the Docker |
| 33 | +registry. |
| 34 | + |
| 35 | +```shell |
| 36 | +UBUNTU_VERSION=noble |
| 37 | +GCC_VERSION=14 |
| 38 | +DOCKER_IMAGE=xrplf/ci/${UBUNTU_VERSION}:gcc${GCC_VERSION} |
| 39 | + |
| 40 | +DOCKER_BUILDKIT=1 docker build . \ |
| 41 | + --target gcc \ |
| 42 | + --build-arg BUILDKIT_INLINE_CACHE=1 \ |
| 43 | + --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \ |
| 44 | + --build-arg GCC_VERSION=${GCC_VERSION} \ |
| 45 | + --tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE} \ |
| 46 | + --platform linux/amd64 |
| 47 | + |
| 48 | +docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE} |
| 49 | +``` |
| 50 | + |
| 51 | +#### Building the Docker image for Clang. |
| 52 | + |
| 53 | +Ensure you've run the login command above to authenticate with the Docker |
| 54 | +registry. |
| 55 | + |
| 56 | +```shell |
| 57 | +UBUNTU_VERSION=noble |
| 58 | +CLANG_VERSION=18 |
| 59 | +DOCKER_IMAGE=xrplf/ci/${UBUNTU_VERSION}:clang${CLANG_VERSION} |
| 60 | + |
| 61 | +DOCKER_BUILDKIT=1 docker build . \ |
| 62 | + --target clang \ |
| 63 | + --build-arg BUILDKIT_INLINE_CACHE=1 \ |
| 64 | + --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \ |
| 65 | + --build-arg CLANG_VERSION=${CLANG_VERSION} \ |
| 66 | + --tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE} \ |
| 67 | + --platform linux/amd64 |
| 68 | + |
| 69 | +docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE} |
| 70 | +``` |
| 71 | + |
| 72 | +### List of Docker images built for CI |
| 73 | + |
| 74 | +As our code requires a minimum of GCC 12 and Clang 16, and Ubuntu only supports |
| 75 | +certain versions depending on the release, we have built the following images |
| 76 | +and pushed them to the GitHub Container Registry: |
| 77 | +* `ghcr.io/xrplf/ci/jammy:gcc12` |
| 78 | +* `ghcr.io/xrplf/ci/noble:gcc14` |
| 79 | +* `ghcr.io/xrplf/ci/noble:clang18` |
| 80 | +* `ghcr.io/xrplf/ci/noble:clang19` |
0 commit comments