Skip to content

Commit ea98db0

Browse files
WhyNotHugomark9064
authored andcommitted
docs: shuffle sections into logical order
The first section explains how to clone the repository, the second how to build Infinitime with the docker image, but the details on actually provisioning the image are at the end, despite this step taking place before the build itself. Move the sections into the order in which the steps should be followed.
1 parent e03414c commit ea98db0

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

doc/buildWithDocker.md

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,37 @@ Based on Ubuntu 22.04 with the following build dependencies:
1515

1616
Before building, local repository must be fully initialized.
1717

18-
```
18+
```sh
1919
git clone https://github.com/InfiniTimeOrg/InfiniTime.git
2020
cd InfiniTime
2121
git submodule update --init
2222
```
2323

24-
## Run a container to build the project
25-
26-
The `infinitime-build` image contains all the dependencies you need.
27-
The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
28-
29-
Before continuing, make sure you first build the image as indicated in the [Build the image](#build-the-image) section, or check the [Using the image from Docker Hub](#using-the-image-from-docker-hub) section if you prefer to use a pre-made image.
24+
## Provision the image
3025

31-
This example will build the firmware, generate the MCUBoot image and generate the DFU file.
32-
For cloning the repo, see [these instructions](../doc/buildAndProgram.md#clone-the-repo). Outputs will be written to **<project_root>/build/output**:
26+
Before continuing, the build image needs to be either build locally or pulled
27+
from Docker Hub, as described in the two sections below:
3328

34-
```bash
35-
cd <project_root> # e.g. cd ./work/Pinetime
36-
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build
37-
```
29+
### Build the image
3830

39-
By default, the container runs as `root`, which is not convenient as all the files generated by the build will also belong to `root`.
40-
The parameter `--user` overrides that default behavior.
41-
The command above will run as your current user.
31+
You can build the image yourself if you like!
4232

43-
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script.
44-
This means calling the script explicitly as it will override the `CMD`.
45-
Here's an example for `pinetime-app`:
33+
The following commands must be run from the root of the project. This operation
34+
will take some time but, when done, a new image named `infinitime-build` is
35+
available.
4636

47-
```bash
48-
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build /opt/build.sh pinetime-app
37+
```sh
38+
docker build -t infinitime-build ./docker
4939
```
5040

51-
## Using the image from Docker Hub
41+
### Pull the image from Docker Hub
5242

53-
The image is available via Docker Hub for both the amd64 and arm64v8 architectures at [infinitime/infinitime-build](https://hub.docker.com/repository/docker/infinitime/infinitime-build).
43+
The image is available via Docker Hub for both the amd64 and arm64v8 architectures at
44+
[infinitime/infinitime-build](https://hub.docker.com/repository/docker/infinitime/infinitime-build).
5445

5546
You can run it using the following command:
5647

57-
```bash
48+
```sh
5849
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime/infinitime-build
5950
```
6051

@@ -64,12 +55,27 @@ The default `latest` tag *should* automatically identify the correct image archi
6455

6556
- For ARM64v8 (ARM64/aarch64) systems: `docker pull --platform linux/arm64 infinitime/infinitime-build`
6657

67-
## Build the image
58+
## Run a container to build the project
6859

69-
You can build the image yourself if you like!
60+
The `infinitime-build` image contains all the dependencies you need.
61+
The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
7062

71-
The following commands must be run from the root of the project. This operation will take some time but, when done, a new image named *infinitime-build* is available.
63+
This example will build the firmware, generate the MCUBoot image and generate the DFU file.
64+
For cloning the repo, see [these instructions](../doc/buildAndProgram.md#clone-the-repo). Outputs will be written to **<project_root>/build/output**:
7265

73-
```bash
74-
docker build -t infinitime-build ./docker
66+
```sh
67+
cd <project_root> # e.g. cd ./work/Pinetime
68+
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build
69+
```
70+
71+
By default, the container runs as `root`, which is not convenient as all the files generated by the build will also belong to `root`.
72+
The parameter `--user` overrides that default behavior.
73+
The command above will run as your current user.
74+
75+
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script.
76+
This means calling the script explicitly as it will override the `CMD`.
77+
Here's an example for `pinetime-app`:
78+
79+
```sh
80+
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build /opt/build.sh pinetime-app
7581
```

0 commit comments

Comments
 (0)