-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Dockerfile
46 lines (43 loc) · 2.05 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
FROM rust:1.76 as build-env
RUN rustup target add x86_64-unknown-linux-musl
WORKDIR /app
COPY Cargo.toml /app
COPY Cargo.lock /app
RUN mkdir -p /app/crates/trippy/src
RUN mkdir -p /app/crates/trippy-tui/src
RUN mkdir -p /app/crates/trippy-core/src
RUN mkdir -p /app/crates/trippy-dns/src
RUN mkdir -p /app/crates/trippy-packet/src
RUN mkdir -p /app/crates/trippy-privilege/src
COPY crates/trippy/Cargo.toml /app/crates/trippy/Cargo.toml
COPY crates/trippy-tui/Cargo.toml /app/crates/trippy-tui/Cargo.toml
COPY crates/trippy-core/Cargo.toml /app/crates/trippy-core/Cargo.toml
COPY crates/trippy-dns/Cargo.toml /app/crates/trippy-dns/Cargo.toml
COPY crates/trippy-packet/Cargo.toml /app/crates/trippy-packet/Cargo.toml
COPY crates/trippy-privilege/Cargo.toml /app/crates/trippy-privilege/Cargo.toml
COPY examples/ /app/examples/
# dummy build to cache dependencies
RUN echo "fn main() {}" > /app/crates/trippy/src/main.rs
RUN touch /app/crates/trippy-tui/src/lib.rs
RUN touch /app/crates/trippy-core/src/lib.rs
RUN touch /app/crates/trippy-dns/src/lib.rs
RUN touch /app/crates/trippy-packet/src/lib.rs
RUN touch /app/crates/trippy-privilege/src/lib.rs
RUN cargo build --release --target=x86_64-unknown-linux-musl --package trippy
# copy the actual application code and build
COPY crates/trippy/src /app/crates/trippy/src
COPY crates/trippy-tui/src /app/crates/trippy-tui/src
COPY crates/trippy-core/src /app/crates/trippy-core/src
COPY crates/trippy-dns/src /app/crates/trippy-dns/src
COPY crates/trippy-packet/src /app/crates/trippy-packet/src
COPY crates/trippy-privilege/src /app/crates/trippy-privilege/src
COPY trippy-config-sample.toml /app
COPY trippy-config-sample.toml /app/crates/trippy-tui
COPY README.md /app
COPY README.md /app/crates/trippy
RUN cargo clean --release --target=x86_64-unknown-linux-musl -p trippy-tui -p trippy-core -p trippy-dns -p trippy-packet -p trippy-privilege
RUN cargo build --release --target=x86_64-unknown-linux-musl
FROM alpine
RUN apk update && apk add ncurses
COPY --from=build-env /app/target/x86_64-unknown-linux-musl/release/trip /
ENTRYPOINT [ "./trip" ]