xitca-web-wasm.dockerfile 987 B

12345678910111213141516171819202122232425262728293031
  1. FROM rust:1.67 AS compile
  2. ARG RUST_TOOLCHAIN_VERSION=nightly-2023-02-20
  3. ARG WASMTIME_VERSION=6.0.0
  4. ARG RUSTFLAGS="-C target-feature=+simd128 --cfg tokio_unstable"
  5. WORKDIR /tmp
  6. COPY Cargo.lock Cargo.toml ./
  7. COPY src ./src/
  8. COPY templates ./templates/
  9. RUN curl -LSs "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-$(uname -m)-linux.tar.xz" | \
  10. tar --strip-components=1 -Jx && \
  11. rustup default "${RUST_TOOLCHAIN_VERSION}" && \
  12. rustup target add wasm32-wasi && \
  13. cargo build --bin xitca-web-wasm --features web --release --target wasm32-wasi
  14. FROM ubuntu:22.04
  15. COPY --from=compile \
  16. /tmp/target/wasm32-wasi/release/xitca-web-wasm.wasm \
  17. /tmp/wasmtime \
  18. /opt/xitca-web-wasm/
  19. EXPOSE 8080
  20. ARG BENCHMARK_ENV
  21. ARG TFB_TEST_DATABASE
  22. ARG TFB_TEST_NAME
  23. CMD /opt/xitca-web-wasm/wasmtime run \
  24. --env FD_COUNT=3 \
  25. --tcplisten 0.0.0.0:8080 \
  26. /opt/xitca-web-wasm/xitca-web-wasm.wasm