xitca-web-wasm.dockerfile 920 B

1234567891011121314151617181920212223242526272829303132333435
  1. ARG WASMTIME_VERSION=12.0.1
  2. ARG WASM_TARGET=wasm32-wasi-preview1-threads
  3. FROM rust:1.67 AS compile
  4. ARG WASMTIME_VERSION
  5. ARG WASM_TARGET
  6. WORKDIR /tmp
  7. COPY / ./
  8. RUN curl -LSs "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-$(uname -m)-linux.tar.xz" | \
  9. tar --strip-components=1 -Jx && \
  10. rustup target add ${WASM_TARGET} && \
  11. cargo build --bin xitca-web-wasm --features serde,web --release --target ${WASM_TARGET}
  12. FROM ubuntu:22.04
  13. ARG WASM_TARGET
  14. COPY --from=compile \
  15. /tmp/target/${WASM_TARGET}/release/xitca-web-wasm.wasm \
  16. /tmp/wasmtime \
  17. /opt/xitca-web-wasm/
  18. EXPOSE 8080
  19. ARG BENCHMARK_ENV
  20. ARG TFB_TEST_DATABASE
  21. ARG TFB_TEST_NAME
  22. CMD /opt/xitca-web-wasm/wasmtime run /opt/xitca-web-wasm/xitca-web-wasm.wasm \
  23. --wasm-features=threads \
  24. --wasi-modules experimental-wasi-threads \
  25. --allow-precompiled \
  26. --env FD_COUNT=3 \
  27. --tcplisten 0.0.0.0:8080