Add option to compile ffishjs in docker
authorFabian Fichter <ianfab@users.noreply.github.com>
Fri, 13 Sep 2024 21:51:19 +0000 (23:51 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 13 Sep 2024 21:51:19 +0000 (23:51 +0200)
tests/js/README.md
tests/js/docker-compose.yml [new file with mode: 0644]

index 5e198ec..bf66b54 100644 (file)
@@ -265,6 +265,13 @@ Make sure that the wasm file is in the `public` directory.
 
 Reference: [emscripten/#10114](https://github.com/emscripten-core/emscripten/issues/10114)
 
+### Compile in docker
+Instead of installing emscripten natively you can also run the compilation in docker from this directory using e.g.
+
+```bash
+DOCKER_USER=$(id -u):$(id -g) docker compose run --rm emscripten make -f Makefile_js build es6=yes
+```
+
 ## Instructions to run the tests
 ```bash
 npm install
diff --git a/tests/js/docker-compose.yml b/tests/js/docker-compose.yml
new file mode 100644 (file)
index 0000000..ed3ecc3
--- /dev/null
@@ -0,0 +1,15 @@
+version: "3.7"
+
+services:
+  # https://github.com/emscripten-core/emsdk/blob/main/docker/README.md
+  emscripten:
+    image: emscripten/emsdk:1.39.16
+    # Allow writing to host filesystem as non-root
+    user: ${DOCKER_USER:-1000:1000}
+    working_dir: /app/src
+    volumes:
+      - ../..:/app
+      - emscripten-cache:/emsdk/upstream/emscripten/cache
+
+volumes:
+  emscripten-cache: