forked from 1tgr/rust-websocket-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
93 lines (75 loc) · 2.72 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
FROM ubuntu:bionic-20220531 as deps
RUN apt-get -y update && apt-get -y install \
clang \
curl \
libssl-dev \
pkg-config
WORKDIR /build
COPY rust-toolchain .
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal -c clippy rustfmt --default-toolchain $(cat rust-toolchain)
ENV PATH=$PATH:/root/.cargo/bin
RUN cargo install cargo-fuzz
COPY rust-nightly-toolchain .
RUN rustup toolchain install $(cat rust-nightly-toolchain)
FROM deps as src
COPY Cargo.toml Cargo.lock ./
COPY assert-allocations/Cargo.toml assert-allocations/
COPY fuzz/Cargo.toml fuzz/
COPY hyper-websocket-lite/Cargo.toml hyper-websocket-lite/
COPY websocket-codec/Cargo.toml websocket-codec/
COPY websocket-lite/Cargo.toml websocket-lite/
RUN mkdir -p \
assert-allocations/src \
hyper-websocket-lite/examples \
hyper-websocket-lite/src \
websocket-codec/benches \
websocket-codec/examples \
websocket-codec/src \
websocket-lite/examples \
websocket-lite/src
RUN touch \
assert-allocations/src/lib.rs \
hyper-websocket-lite/src/lib.rs \
websocket-codec/src/lib.rs \
websocket-lite/src/lib.rs
RUN \
echo "fn main() {}" > hyper-websocket-lite/examples/autobahn-server.rs && \
echo "fn main() {}" > hyper-websocket-lite/examples/hello-world-server.rs && \
echo "fn main() {}" > websocket-codec/benches/bench.rs && \
echo "fn main() {}" > websocket-codec/examples/wsinspect.rs && \
echo "fn main() {}" > websocket-lite/examples/async-autobahn-client.rs && \
echo "fn main() {}" > websocket-lite/examples/autobahn-client.rs && \
echo "fn main() {}" > websocket-lite/examples/discord.rs && \
echo "fn main() {}" > websocket-lite/examples/hello-world-client.rs && \
echo "fn main() {}" > websocket-lite/examples/wsdump.rs
ENV RUSTFLAGS=-Dwarnings
RUN cargo build --workspace --exclude fuzz --all-targets --all-features
COPY . .
RUN find . -name "*.rs" | grep -v "^\./target" | xargs touch
FROM src as build
RUN cargo build --release --workspace --exclude fuzz --all-targets
FROM build as fuzz
RUN mv rust-nightly-toolchain rust-toolchain
RUN cargo fuzz build
FROM ubuntu:bionic-20220531 as app
RUN apt-get -y update && apt-get -y install \
ca-certificates \
netcat \
openssl \
python-pip \
python2.7 \
python3-pip
RUN pip2 install \
wsaccel==0.6.3 \
autobahntestsuite
RUN pip3 install \
websockets
WORKDIR /app
COPY --from=build \
/build/target/release/examples/async-autobahn-client \
/build/target/release/examples/autobahn-client \
/build/target/release/examples/autobahn-server \
/build/target/release/examples/hello-world-client \
/build/target/release/examples/hello-world-server \
/build/target/release/examples/wsdump \
./