Update dockerfiles

This commit is contained in:
Noah
2020-03-12 18:40:52 +00:00
parent 3d07a73346
commit b316b8ef2a
2 changed files with 15 additions and 23 deletions

View File

@@ -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" ]

View File

@@ -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