summaryrefslogtreecommitdiffhomepage
path: root/examples/docker/demo-wasm.Dockerfile
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-08-02 17:03:48 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-08-21 23:24:12 +0100
commitd6ed6a219b31a58526721f96195c80061d41ce54 (patch)
tree17a1fd6ecf72a327916ff0f8bc7aaf85b981ceff /examples/docker/demo-wasm.Dockerfile
downloadunit-wasm-c43c6b57d70ae3a2cb3a52f5f991cd68fd39b47d.tar.gz
unit-wasm-c43c6b57d70ae3a2cb3a52f5f991cd68fd39b47d.tar.bz2
Initial commitv0.1.0
libunit-wasm and example C and Rust WebAssembly modules for NGINX Unit. Co-developed-by: Timo Stark <t.stark@nginx.com> Co-developed-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'examples/docker/demo-wasm.Dockerfile')
-rw-r--r--examples/docker/demo-wasm.Dockerfile20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/docker/demo-wasm.Dockerfile b/examples/docker/demo-wasm.Dockerfile
new file mode 100644
index 0000000..2385211
--- /dev/null
+++ b/examples/docker/demo-wasm.Dockerfile
@@ -0,0 +1,20 @@
+FROM unit:wasm AS build
+WORKDIR /demo
+
+# Get all the build tools we need
+#
+RUN apt update && apt install -y wget build-essential clang llvm lld
+RUN cd /usr/lib/llvm-11/lib/clang/11.0.1 && wget -O- https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/libclang_rt.builtins-wasm32-wasi-20.0.tar.gz | tar zxvf -
+RUN wget -O- https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sysroot-20.0.tar.gz | tar zxfv -
+
+# Copy-in the demo application source code and build into a .wasm module
+#
+ADD ${PWD} /demo/
+RUN make WASI_SYSROOT=/demo/wasi-sysroot examples
+
+# Copy the .wasm modules and Unit configuration to the final Docker image
+# that will run the demo application.
+#
+FROM unit:wasm
+COPY --from=build /demo/examples/c/*.wasm /demo/
+ADD examples/docker/wasm-conf.json /docker-entrypoint.d