Docker container documentation : Fix typos, 1 line per sentence, remove obsolete paragraph, remove redundant 'image' parameter in the command to build the docker image, use ${PWD} instead of $(pwd).
This commit is contained in:
parent
9b216bb16f
commit
dd313eb419
|
@ -1,6 +1,7 @@
|
|||
# Build the project using Docker
|
||||
|
||||
A [Docker image (Dockerfile)](../docker) containing all the build environment is available for X86_64 and AMD64 architectures. These images make the build of the firmware and the generation of the DFU file for OTA quite easy, as well as preventing clashes with any other toolchains or development environments you may have installed.
|
||||
A [Docker image (Dockerfile)](../docker) containing all the build environment is available for X86_64 and AMD64 architectures.
|
||||
These images make the build of the firmware and the generation of the DFU file for OTA quite easy, as well as preventing clashes with any other toolchains or development environments you may have installed.
|
||||
|
||||
Based on Ubuntu 22.04 with the following build dependencies:
|
||||
|
||||
|
@ -12,39 +13,39 @@ Based on Ubuntu 22.04 with the following build dependencies:
|
|||
|
||||
## Run a container to build the project
|
||||
|
||||
The `infinitime-build` image contains all the dependencies you need. The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
|
||||
The `infinitime-build` image contains all the dependencies you need.
|
||||
The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
|
||||
|
||||
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.
|
||||
|
||||
This example will build the firmware, generate the MCUBoot image and generate the DFU file. For cloning the repo, see [these instructions](../doc/buildAndProgram.md#clone-the-repo). Outputs will be written to **<project_root>/build/output**:
|
||||
This example will build the firmware, generate the MCUBoot image and generate the DFU file.
|
||||
For cloning the repo, see [these instructions](../doc/buildAndProgram.md#clone-the-repo). Outputs will be written to **<project_root>/build/output**:
|
||||
|
||||
```bash
|
||||
cd <project_root> # e.g. cd ./work/Pinetime
|
||||
docker run --rm -it -v $(pwd):/sources --user $(id -u):$(id -g) infinitime-build
|
||||
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build
|
||||
```
|
||||
|
||||
By default, the container runs as `root`, which is not convenient as all the file generated by the build will also belong to `root`. The parameter `--user` overrides that default behavior. The command above will run as your current user.
|
||||
By default, the container runs as `root`, which is not convenient as all the files generated by the build will also belong to `root`.
|
||||
The parameter `--user` overrides that default behavior.
|
||||
The command above will run as your current user.
|
||||
|
||||
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script. This means calling the script explicitly as it will override the `CMD`. Here's an example For `pinetime-app`:
|
||||
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script.
|
||||
This means calling the script explicitly as it will override the `CMD`.
|
||||
Here's an example for `pinetime-app`:
|
||||
|
||||
```bash
|
||||
docker run --rm -it -v $(pwd):/sources --user $(id -u):$(id -g) infinitime-build /opt/build.sh pinetime-app
|
||||
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build /opt/build.sh pinetime-app
|
||||
```
|
||||
|
||||
## Using the image from Docker Hub
|
||||
|
||||
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).
|
||||
|
||||
It can be pulled (downloaded) using the following command:
|
||||
You can run it using the following command:
|
||||
|
||||
```bash
|
||||
docker pull infinitime/infinitime-build
|
||||
```
|
||||
|
||||
The command line to build the project is the same as above. You just need to change the image name to `infinitime/infinitime-build`:
|
||||
|
||||
```
|
||||
docker run --rm -it -v $(pwd):/sources --user $(id -u):$(id -g) infinitime/infinitime-build
|
||||
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime/infinitime-build
|
||||
```
|
||||
|
||||
The default `latest` tag *should* automatically identify the correct image architecture, but if for some reason Docker does not, you can specify it manually:
|
||||
|
@ -60,5 +61,5 @@ You can build the image yourself if you like!
|
|||
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.
|
||||
|
||||
```bash
|
||||
docker image build -t infinitime-build ./docker
|
||||
docker build -t infinitime-build ./docker
|
||||
```
|
Loading…
Reference in New Issue