Skip to content

Commit 19a0ccb

Browse files
committed
docs(chip-wasm-guide): use wokwi/builder-clang-wasm instead of manually creating an image
1 parent 4a218ef commit 19a0ccb

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

docs/guides/custom-chips-to-wasm.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,29 @@ Once done, you should be presented with a terminal window where you can now run
6969
the repository, and your generated WASM files should appear in `dist/`.
7070

7171
### Docker
72-
You will have to build the [wokwi-chip-clang-action](https://github.com/wokwi/wokwi-chip-clang-action) container to make
73-
use of it, as there currently is no image available online.
74-
75-
#### Create the image
76-
1. Clone the [wokwi-chip-clang-action](https://github.com/wokwi/wokwi-chip-clang-action) repository
77-
2. Navigate to it
78-
3. Run `docker build --tag "local/wokwi-chip-clang-action"`
79-
80-
Once the `docker build` command finishes, you will be able to reference the newly created image with
81-
`local/wokwi-chip-clang-action`.
82-
83-
#### Use the image
84-
1. Navigate to your project directory which contains the C source code to compile
85-
2. Create and enter a container with `docker run --rm -it -v $(pwd):/usr/src/project --entrypoint=/bin/sh local/wokwi-chip-clang-action`
86-
3. Your prompt should now have changed - navigate to `/usr/src/project`
87-
4. Compile the project with `make`
72+
You can use the prebuilt [wokwi/builder-clang-wasm](https://hub.docker.com/r/wokwi/builder-clang-wasm) image to compile
73+
your project in a Docker environment.
74+
75+
To get started, simply navigate to the root of your project and run:
76+
```bash
77+
docker run --rm -u 1000:1000 -v ${PWD}:/src wokwi/builder-clang-wasm:latest make
78+
```
79+
80+
After fetching the image, this will command automatically execute the `Makefile` in the project. In the case of the
81+
inverter example, will create the `dist/` directory, compile the binary into `dist/chip.wasm` and copy `chip.json` to
82+
`dist/`.
83+
84+
You can enter an interactive session with the following:
85+
```bash
86+
docker run --rm -it -u 1000:1000 -v ${PWD}:/src wokwi/builder-clang-wasm:latest
87+
```
88+
89+
:::info
90+
The argument `-u 1000:1000` is required since otherwise you may run into issues with permissions (such as the container
91+
being unable to open files or create directories). If your computer has multiple users, you may have to update
92+
the value to something other than `1000` - check the output of the `id` command on the host to get the proper value.
93+
:::
94+
8895

8996
### Building locally
9097

0 commit comments

Comments
 (0)