-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update Docker documentation to use tabs instead of separate pages.
- Loading branch information
Showing
7 changed files
with
195 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
--- | ||
title: Docker | ||
sidebar_label: Docker | ||
--- | ||
|
||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
|
||
### Source Code | ||
|
||
First, you'll need to clone the ZMK source repository if you haven't already. | ||
Open a terminal and navigate to the folder you would like to place your `zmk` | ||
directory in, then run the following command: | ||
|
||
```sh | ||
git clone https://github.com/zmkfirmware/zmk.git | ||
``` | ||
|
||
### Docker Setup | ||
|
||
<Tabs defaultValue="vsCode" | ||
values={[ | ||
{label: 'VS Code', value: 'vsCode'}, | ||
{label: 'Dev Container CLI', value: 'cli'} | ||
]}> | ||
<TabItem value="vsCode"> | ||
:::note | ||
This approach is documented for | ||
[VS Code](https://github.com/microsoft/vscode) not | ||
[Code OSS](https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code). | ||
::: | ||
|
||
#### Installing Development Tools | ||
|
||
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop) for | ||
your operating system. | ||
2. Install [VS Code](https://code.visualstudio.com/). | ||
3. Install the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). | ||
|
||
#### Initialize & Update Zephyr Workspace | ||
|
||
Open the `zmk` checkout directory in VS Code. The repository includes a | ||
configuration for containerized development. Therefore, an alert will pop up: | ||
|
||
![VS Code Dev Container Configuration Alert](../../../assets/dev-setup/vscode_devcontainer.png) | ||
|
||
Click `Reopen in Container` to reopen the VS Code with the running container. If | ||
the alert fails to pop up or you accidentally close it, you can perform the same | ||
action by pressing the following keys based on your operating system and | ||
selecting `Remote: Show Remote Menu`: | ||
|
||
- **Windows/Linux**: `Ctrl + Shift + P` | ||
- **MacOs**: `Cmd + Shift + P` | ||
|
||
The first time you do this on your machine, it will pull down the Docker image | ||
from the registry and build the container. **Subsequent launches are much | ||
faster!** | ||
|
||
:::caution | ||
The following step and any future [build commands](../build-flash.mdx) must be | ||
executed from the VS Code terminal _inside_ the container. | ||
::: | ||
|
||
Initialize the application and update modules, including Zephyr: | ||
|
||
```sh | ||
west init -l app/ | ||
west update | ||
``` | ||
|
||
:::tip | ||
This step pulls down quite a bit of tooling, be patient! | ||
::: | ||
|
||
:::info | ||
You must restart the container at this point. The easiest way to do this is to | ||
close the VS Code window, verify that the container has stopped in the Docker | ||
Dashboard, and reopen the container with VS Code. | ||
|
||
Your setup is complete once your container has restarted. | ||
::: | ||
|
||
</TabItem> | ||
<TabItem value="cli"> | ||
#### Installing Development Tools | ||
|
||
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop) | ||
for your operating system. | ||
2. Install the [Dev Container CLI](https://github.com/devcontainers/cli). | ||
|
||
#### Initialize & Update Zephyr Workspace | ||
|
||
Open up your Terminal and make sure that the | ||
[Dev Container CLI](https://github.com/devcontainers/cli) is installed by | ||
running: | ||
|
||
```sh | ||
devcontainer --version | ||
``` | ||
|
||
To be able to execute commands, the | ||
[Dev Container CLI](https://github.com/devcontainers/cli) has to know where the | ||
`devcontainer.json` is located. This can be done using the `--workspace-folder` | ||
option, which is available for all commands and will automatically look up the | ||
file relative to the path. Therefore, the container can be started by executing: | ||
|
||
```sh | ||
devcontainer up --workspace-folder "/absolute/path/to/zmk" | ||
``` | ||
|
||
The first time you do this on your machine, it will pull down the Docker image | ||
from the registry and build the container. **Subsequent launches are much | ||
faster!** | ||
|
||
Once the command is finished, the development environment is available. | ||
Furthermore, the path is mounted under `/workspaces/zmk/`. It can then be used | ||
to initialize the application and update modules, including Zephyr. | ||
|
||
```sh | ||
devcontainer exec --workspace-folder "/absolute/path/to/zmk" \ | ||
west init -l "/workspaces/zmk/app" | ||
devcontainer exec --workspace-folder "/absolute/path/to/zmk" \ | ||
west update | ||
``` | ||
|
||
:::tip | ||
This step pulls down quite a bit of tooling, be patient! | ||
::: | ||
|
||
:::info | ||
You must restart the container at this point. This can be done by using: | ||
|
||
```sh | ||
docker container ps # List active containers | ||
docker container stop "<container-id>" # Stop the container | ||
``` | ||
|
||
Your setup is complete once your container has been restarted. | ||
::: | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
### Volume Setup | ||
|
||
In case you have a `zmk-config` or want to build with additional modules, it is | ||
necessary to first make those available to the Docker container. This can be | ||
done by mounting them as volumes. | ||
|
||
But before you do so, first check that neither ZMK related containers nor the | ||
`zmk-config` and `zmk-modules` volumes exist. This can be done with: | ||
|
||
```sh | ||
docker container ps # List active containers | ||
docker container stop "<container-id>" # Stop the container | ||
docker container rm "<container-id>" # Remove the container | ||
|
||
docker volume ls # List volumes | ||
docker volume rm "<volume-name>" # Remove volume | ||
``` | ||
|
||
:::note | ||
You can also use `docker container prune` to remove all containers if no others | ||
are running. | ||
::: | ||
|
||
<Tabs | ||
defaultValue="config" | ||
values={[ | ||
{ label: "Zmk-Config", value: "config" }, | ||
{ label: "Modules", value: "modules" }, | ||
]} | ||
> | ||
<TabItem value="config"> | ||
```sh docker volume create --driver local -o o=bind -o type=none \ -o | ||
device="/absolute/path/to/zmk-config/" zmk-config ``` | ||
</TabItem> | ||
<TabItem value="modules"> | ||
```sh docker volume create --driver local -o o=bind -o type=none -o \ | ||
device="/absolute/path/to/zmk-modules/parent/" zmk-modules ``` | ||
</TabItem> | ||
</Tabs> | ||
:::tip | ||
Once this is done, you can refer to the `zmk-config` with | ||
`/workspace/zmk-config` and `/workspace/zmk-modules` to the modules instead of | ||
using their full path like it is shown in the | ||
[build commands](../build-flash.mdx), since these are the locations they were | ||
mounted to in the container. | ||
::: |
This file was deleted.
Oops, something went wrong.
77 changes: 0 additions & 77 deletions
77
docs/docs/development/local-toolchain/setup/docker/index.md
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
docs/docs/development/local-toolchain/setup/docker/vscode.md
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.