Skip to content

Commit 656fed2

Browse files
committed
Improve Docker based build setup docs
1 parent cdb2eb0 commit 656fed2

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

BUILD.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,53 @@ Using containers provides the following advantages:
1414
The build process has been automated completely. As a user, you just need to run the `build-with-docker.sh` script:
1515

1616
```sh
17-
> env ARCH=<arch> ./build-with-docker.sh
17+
> env ARCH=<arch> scripts/build-with-docker.sh
1818
```
1919

2020
The resulting AppImages will end up in your current working directory.
21+
22+
23+
### Interactive environment
24+
25+
You can spawn a development container locally using the following command:
26+
27+
```sh
28+
> env ARCH=<arch> scripts/build-with-docker.sh
29+
```
30+
31+
32+
### Emulate foreign architectures
33+
34+
Docker supports using `binfmt_misc` and static QEMU builds to transparently run Docker images built for other architectures which the current CPU does not support. This way, one can, e.g., run a Docker container built for 64-bit ARM processors on a regular 64-bit AMD/Intel system.
35+
36+
To create an interactive container, that is, you can execute commands in there, you can use the following script:
37+
38+
```sh
39+
> env ARCH=<arch> scripts/create-build-container.sh [docker args...]
40+
```
41+
42+
This script first builds the Docker image (if necessary), then runs a container based on it.
43+
44+
The container mounts the repository's root directory in `/ws` so that you can run scripts, build the software etc.
45+
46+
You can optionally append Docker arguments. For instance, to run the container as a different user than `root` (which is the default), you can use the script as follows:
47+
48+
```sh
49+
# bash
50+
> env ARCH=<arch> scripts/create-build-container.sh -u "$(id -u):$(id -g)"
51+
52+
# fish
53+
> env ARCH=<arch> scripts/create-build-container.sh -u (id -u):(id -g)
54+
```
55+
56+
This is primarily useful if you don't intend to install packages interactively. It makes sure that the project can be built without root access. Packages can be installed by modifying the `install-dependencies.sh` script.
57+
58+
To specify commands that should be run, use the established `--` to distinguish these from Docker args:
59+
60+
```sh
61+
# bash
62+
> env ARCH=<arch> scripts/create-build-container.sh -u "$(id -u):$(id -g)" -- bash some-script.sh
63+
64+
# fish
65+
> env ARCH=<arch> scripts/create-build-container.sh -u $(id -u):(id -g) -- bash some-script.sh
66+
```

0 commit comments

Comments
 (0)