aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: f22575be9ad51a9ac3a691eb4b45e9514ab16066 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM rust:1.57-bullseye as builder

RUN apt-get update && \
    apt-get install -y libssl-dev pkg-config

WORKDIR /srv

# Build dependencies and cache them
COPY Cargo.* ./
RUN mkdir -p src && \
    echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \
    cargo build --release && \
    rm -r src && \
    rm target/release/deps/diplonat*

# Build final app
COPY ./src ./src
RUN cargo build --release

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y libssl1.1 iptables
COPY --from=builder /srv/target/release/diplonat /usr/local/sbin/diplonat
CMD ["/usr/local/sbin/diplonat"]