forked from Rust-related/RustPython
33 lines
667 B
Docker
33 lines
667 B
Docker
FROM rust:slim AS rust
|
|
|
|
WORKDIR /rustpython
|
|
|
|
USER root
|
|
ENV USER root
|
|
|
|
|
|
RUN apt-get update && apt-get install curl libssl-dev pkg-config -y && \
|
|
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
COPY . .
|
|
|
|
RUN cd wasm/lib/ && wasm-pack build --release
|
|
|
|
|
|
FROM node:alpine AS node
|
|
|
|
WORKDIR /rustpython-demo
|
|
|
|
COPY --from=rust /rustpython/wasm/lib/pkg rustpython_wasm
|
|
|
|
COPY wasm/demo .
|
|
|
|
RUN npm install && npm run dist -- --env.noWasmPack --env.rustpythonPkg=rustpython_wasm
|
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=node /rustpython-demo/dist /usr/share/nginx/html
|
|
# Add the WASM mime type
|
|
RUN echo "types { application/wasm wasm; }" >>/etc/nginx/mime.types
|