-
Notifications
You must be signed in to change notification settings - Fork 207
/
Dockerfile
70 lines (51 loc) · 1.76 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM ubuntu:18.04 as toolchain
# `build-essential` and `file` are needed for backtrace-sys
# `cmake`, `git`, `python` are needed for wasm tools
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
curl \
file \
gcc \
git \
libssl-dev \
pkg-config \
python \
&& rm -rf /var/lib/apt/lists/*
ENV USER=root
ENV PATH=/root/.cargo/bin:$PATH
ADD entrypoint.sh /root/
ARG channel
# Ensure that we are using the latest stable version of rustup and the
# latest version of the current channel. A new manifest will trigger
# these lines to run again, forcing a new download of rustup and
# installation of Rust.
ADD https://static.rust-lang.org/rustup/release-stable.toml /root/rustup-manifest.toml
ADD https://static.rust-lang.org/dist/channel-rust-${channel}-date.txt /root/rust-channel-version
# https://github.com/rust-lang-nursery/rustup.rs/issues/998
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "${channel}" && \
rm -rf ~/.rustup/toolchains/*/share/doc
# Prebuild the playground's dependencies
FROM toolchain as dependencies
RUN cd / && \
cargo new playground
WORKDIR /playground
ADD Cargo.toml /playground/Cargo.toml
RUN cargo fetch
RUN cargo build
RUN cargo build --release
RUN rm src/*.rs
# Build our tool for modifying Cargo.toml at runtime
FROM dependencies as munge
ADD modify-cargo-toml /modify-cargo-toml
RUN cd /modify-cargo-toml && \
cargo build --release
# Put everything together
FROM dependencies
ENTRYPOINT ["/root/entrypoint.sh"]
ARG channel
ADD crate-information.json /playground/crate-information.json
ADD postinstall.sh /root/
RUN /root/postinstall.sh ${channel}
ADD cargo-wasm /root/.cargo/bin/
COPY --from=munge /modify-cargo-toml/target/release/modify-cargo-toml /root/.cargo/bin