docs and a compose file for docker compose builds
sets up an alternative docker-based build environment for people not using vscode
This commit is contained in:
parent
e3eb77dfc6
commit
850a335e58
3 changed files with 54 additions and 2 deletions
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
version: "3.9"
|
||||
services:
|
||||
shell:
|
||||
ports:
|
||||
- 3000
|
||||
build:
|
||||
context: .devcontainer/
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- $PWD:/workspace
|
||||
- zmk-root-user:/root
|
||||
- zmk-zephyr:/workspace/zephyr
|
||||
- zmk-zephyr-modules:/workspace/modules
|
||||
- zmk-zephyr-tools:/workspace/tools
|
||||
|
||||
volumes:
|
||||
zmk-root-user:
|
||||
zmk-zephyr:
|
||||
zmk-zephyr-modules:
|
||||
zmk-zephyr-tools:
|
|
@ -90,7 +90,11 @@ This produces `left` and `right` subfolders under the `build` directory and two
|
|||
|
||||
### Building from `zmk-config` Folder
|
||||
|
||||
Instead of building .uf2 files using the default keymap and config files, you can build directly from your [`zmk-config` folder](../user-setup.md#github-repo) by adding
|
||||
Getting your `zmk-config` to be used by your build environment differs based on what type of build environment you are using.
|
||||
|
||||
#### non-containerized environment
|
||||
|
||||
Instead of building .uf2 files using the default keymap and config files, you can build directly from your [`zmk-config` folder](../user-setup#github-repo) by adding
|
||||
`-DZMK_CONFIG="C:/the/absolute/path/config"` to your `west build` command. **Notice that this path should point to the folder labelled `config` within your `zmk-config` folder.**
|
||||
|
||||
For instance, building kyria firmware from a user `myUser`'s `zmk-config` folder on Windows 10 may look something like this:
|
||||
|
@ -99,6 +103,8 @@ For instance, building kyria firmware from a user `myUser`'s `zmk-config` folder
|
|||
west build -b nice_nano -- -DSHIELD=kyria_left -DZMK_CONFIG="C:/Users/myUser/Documents/Github/zmk-config/config"
|
||||
```
|
||||
|
||||
#### VSCode Remote Container environnment
|
||||
|
||||
In order to make your `zmk-config` folder available when building within the VSCode Remote Container, you need to create a docker volume named `zmk-config`
|
||||
by binding it to the full path of your config directory. If you have run the VSCode Remote Container before, it is likely that docker has created this
|
||||
volume automatically -- we need to delete the default volume before binding it to the correct path. Follow the following steps:
|
||||
|
@ -116,6 +122,16 @@ docker volume create --driver local -o o=bind -o type=none -o \
|
|||
|
||||
Now start VSCode and rebuild the container after being prompted. You should be able to see your zmk-config mounted to `/workspaces/zmk-config` inside the container. So you can build your custom firmware with `-DZMK_CONFIG="/workspaces/zmk-config/config"`.
|
||||
|
||||
#### docker compose build environment
|
||||
|
||||
Attaching your `zmk-config` to your docker-compose build environment is done by specifying a volume mount when running the service:
|
||||
|
||||
```
|
||||
docker compose run --rm -v /full/path/to/your/zmk-config:/workspace/zmk-config shell bash
|
||||
```
|
||||
|
||||
Now you can build your custom firmware with `-DZMK_CONFIG=/workspace/zmk-config/config".`
|
||||
|
||||
## Flashing
|
||||
|
||||
The above build commands generate a UF2 file in `build/zephyr` (or
|
||||
|
|
|
@ -16,6 +16,7 @@ values={[
|
|||
{label: 'Raspberry OS', value: 'raspberryos'},
|
||||
{label: 'Fedora', value: 'fedora'},
|
||||
{label: 'VS Code & Docker', value: 'docker'},
|
||||
{label: 'docker compose', value: 'dockercompose'},
|
||||
]
|
||||
}>{props.children}</Tabs>);
|
||||
|
||||
|
@ -195,7 +196,7 @@ This setup leverages the same [image which is used by the GitHub action](https:/
|
|||
3. Install the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
|
||||
:::info
|
||||
The docker container includes `west` and the compilation toolchain. If you're using docker and VS Code, you can skip right to [Source Code](#source-code).
|
||||
The docker container includes `west` and the compilation toolchain. If you're using docker and VS Code, or `docker compose`, you can skip right to [Source Code](#source-code).
|
||||
:::
|
||||
|
||||
</TabItem>
|
||||
|
@ -421,6 +422,20 @@ All subsequent steps must be performed from the VS Code terminal _inside_ the co
|
|||
:::
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="dockercompose">
|
||||
|
||||
Open a terminal and `cd` into your `zmk` repository.
|
||||
|
||||
Run `docker compose up -d`.
|
||||
|
||||
To enter the build environment container, run `docker compose run --rm shell bash`. The zmk repo will be mounted into the `/workspace` directory.
|
||||
|
||||
:::caution
|
||||
All subsequent steps must be performed _inside_ the container.
|
||||
:::
|
||||
</TabItem>
|
||||
|
||||
</OsTabs>
|
||||
|
||||
#### Initialize West
|
||||
|
|
Loading…
Add table
Reference in a new issue