|
1 | 1 | # riotbuild |
2 | 2 | Dockerfiles for creating build environment for building RIOT projects. |
| 3 | + |
| 4 | +## Building your own images |
| 5 | + |
| 6 | +The RIOT build system containers are staggered. The foundation is set by |
| 7 | +`riotdocker-base`, which sets up the user inside of the container and |
| 8 | +sets traps for `SIGINT` and `SIGTERM` signals. |
| 9 | + |
| 10 | +You can build the image with the following command: |
| 11 | + |
| 12 | +```sh |
| 13 | +docker build --pull -t riotdocker-base ./riotdocker-base/ |
| 14 | +``` |
| 15 | + |
| 16 | +The second image, `static-test-tools`, builds upon `riotdocker-base` and |
| 17 | +contains all of the tools that are required to run the RIOT static tests. |
| 18 | +This image is also used by the `static-test` GitHub workflow in the main |
| 19 | +`RIOT` repository. |
| 20 | + |
| 21 | +You can build the image with the following command. Setting the |
| 22 | +`DOCKER_REGISTRY` argument ensures that the local copy of the container is used |
| 23 | +instead of the upstream version. You can omit this parameter if you haven't |
| 24 | +made any changes to `riotdocker-base`. |
| 25 | + |
| 26 | +***NOTE:*** If docker complains about not finding the image, you can try to |
| 27 | +set the `DOCKER_REGISTRY` argument to `localhost` instead. |
| 28 | + |
| 29 | +```sh |
| 30 | +docker build --build-arg DOCKER_REGISTRY=docker.io/library -t static-test-tools ./static-test-tools/ |
| 31 | +``` |
| 32 | + |
| 33 | +The third image, `riotbuild`, builds upon the `static-test-tools` and contains |
| 34 | +the full build environment required to build all platforms in `RIOT`. |
| 35 | +This container is rather big (>10GB) and takes a good while to build. |
| 36 | + |
| 37 | +You can run the following command to build it. Again, the `DOCKER_REGISTRY` |
| 38 | +command is optional if you haven't made any changes to `static-test-tools`. |
| 39 | + |
| 40 | +```sh |
| 41 | +docker build --build-arg DOCKER_REGISTRY=docker.io/library -t riotbuild ./riotbuild/ |
| 42 | +``` |
| 43 | + |
| 44 | +The fourth image, `murdock-worker`, builds upon `riotbuild` and contains |
| 45 | +everything that is used by the CI and can be built with the following command. |
| 46 | +Again, the `DOCKER_REGISTRY` command is optional if you haven't made any |
| 47 | +changes to `riotbuild`. |
| 48 | + |
| 49 | +```sh |
| 50 | +docker build --build-arg DOCKER_REGISTRY=docker.io/library -t murdock-worker ./murdock-worker/ |
| 51 | +``` |
| 52 | + |
| 53 | +## Testing your changes |
| 54 | + |
| 55 | +Before you can test your changes, you have to find out the Image ID of your |
| 56 | +freshly baked container. For example, if you want to search for `riotbuild`, |
| 57 | +you can have docker list all containers that match that name. |
| 58 | + |
| 59 | +```sh |
| 60 | +riotdocker$ docker image list riotbuild |
| 61 | +REPOSITORY TAG IMAGE ID CREATED SIZE |
| 62 | +riotbuild latest f610ef8e4bbd 19 minutes ago 14.9GB |
| 63 | +``` |
| 64 | + |
| 65 | +Depending on your changes and what you want to test, you can either start a |
| 66 | +shell inside of the container with the following command: |
| 67 | + |
| 68 | +```sh |
| 69 | +docker run --rm --user $(id -u):$(id -g) -it f610ef8e4bbd bash |
| 70 | +riotbuild@f610ef8e4bbd:~$ |
| 71 | +``` |
| 72 | + |
| 73 | +Or you can pass your image to the RIOT build system and build an application |
| 74 | +or test of your liking: |
| 75 | + |
| 76 | +```sh |
| 77 | +BUILD_IN_DOCKER=1 DOCKER_IMAGE=f610ef8e4bbd BOARD=nrf52840dk make -C tests/sys/shell |
| 78 | +``` |
0 commit comments