https://github.com/tuananh/emsdk-docker
Docker image for emsdk
https://github.com/tuananh/emsdk-docker
docker emsdk
Last synced: over 1 year ago
JSON representation
Docker image for emsdk
- Host: GitHub
- URL: https://github.com/tuananh/emsdk-docker
- Owner: tuananh
- Created: 2018-01-04T09:51:37.000Z (over 8 years ago)
- Default Branch: develop
- Last Pushed: 2018-01-04T14:28:29.000Z (over 8 years ago)
- Last Synced: 2025-01-24T16:29:04.907Z (over 1 year ago)
- Topics: docker, emsdk
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
emsdk-docker
------------
> Docker container with emsdk installed.
## Example usage
We can use this Docker image to build C/C++ files without the need to setup
Emscripten on the host machine.
Put the below script in your `package.json` scripts
```sh
docker run -it --rm -u $(id -u):$(id -g) -v $PWD:/src -w /src tuananh/emsdk emcc -O3 src/xxhash.c -s WASM=1 -s SIDE_MODULE=1 -o src/xxhash.wasm
```
In this example, suppose our project has a `src` folder with a C file `xxhash.c` in it.
What we do here is that we will mount the `src` folder into the container's `/src` folder, compile
it the `.wasm` there in the container and output it back to the host's `src` folder.
```json
"scripts": {
"build": "docker run -it --rm -u $(id -u):$(id -g) -v $PWD:/src -w /src tuananh/emsdk emcc -O3 src/xxhash.c -s WASM=1 -s SIDE_MODULE=1 -o src/xxhash.wasm",
"test": "echo \"Error: no test specified\" && exit 1"
},
```
and `yarn build`. BAM!! your `.wasm` file is there in the `src` folder.