From b316b8ef2abaedf1f5a863b83cd9863a00a6def8 Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Thu, 12 Mar 2020 18:40:52 +0000 Subject: [PATCH] Update dockerfiles --- Dockerfile.bin | 10 ++++++++-- Dockerfile.wasm | 28 +++++++--------------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/Dockerfile.bin b/Dockerfile.bin index 97488b46d..bf0a8ff46 100644 --- a/Dockerfile.bin +++ b/Dockerfile.bin @@ -1,4 +1,4 @@ -FROM rust:1.36-slim +FROM rust:latest as rust WORKDIR /rustpython @@ -6,4 +6,10 @@ COPY . . RUN cargo build --release -CMD [ "/rustpython/target/release/rustpython" ] +FROM debian:stable-slim + +COPY --from=rust /rustpython/target/release/rustpython /usr/bin +COPY --from=rust /rustpython/Lib /usr/lib/rustpython +ENV RUSTPYTHONPATH /usr/lib/rustpython + +ENTRYPOINT [ "rustpython" ] diff --git a/Dockerfile.wasm b/Dockerfile.wasm index 921492b7e..a2a1b4c8b 100644 --- a/Dockerfile.wasm +++ b/Dockerfile.wasm @@ -1,23 +1,15 @@ -FROM rust:1.36-slim AS rust +FROM rust:slim AS rust WORKDIR /rustpython USER root -ENV 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 Cargo.toml Cargo.lock ./ -COPY src src -COPY vm vm -COPY derive derive -COPY parser parser -COPY bytecode bytecode -COPY compiler compiler -COPY wasm/lib wasm/lib -COPY Lib Lib +COPY . . RUN cd wasm/lib/ && wasm-pack build --release @@ -33,14 +25,8 @@ COPY wasm/demo . RUN npm install && npm run dist -- --env.noWasmPack --env.rustpythonPkg=rustpython_wasm -FROM node:slim +FROM nginx:alpine -WORKDIR /rustpython-demo - -RUN npm i -g serve - -COPY --from=node /rustpython-demo/dist . - -CMD [ "serve", "-l", "80", "/rustpython-demo" ] - -EXPOSE 80 +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