41 lines
1.5 KiB
Docker
41 lines
1.5 KiB
Docker
|
####################################################################################################
|
||
|
## Builder
|
||
|
####################################################################################################
|
||
|
FROM rust as planner
|
||
|
RUN apt update && apt install -y build-essential musl-tools musl-dev clang libclang-dev libsqlite3-dev
|
||
|
RUN update-ca-certificates
|
||
|
WORKDIR /app
|
||
|
RUN cargo install cargo-chef
|
||
|
COPY . .
|
||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||
|
|
||
|
FROM rust as cacher
|
||
|
RUN apt update && apt install -y build-essential musl-tools musl-dev clang libclang-dev libsqlite3-dev
|
||
|
RUN update-ca-certificates
|
||
|
WORKDIR /app
|
||
|
RUN cargo install cargo-chef
|
||
|
COPY --from=planner /app/recipe.json recipe.json
|
||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||
|
|
||
|
FROM rust as builder
|
||
|
RUN apt update && apt install -y build-essential musl-tools musl-dev clang libclang-dev libsqlite3-dev
|
||
|
RUN update-ca-certificates
|
||
|
WORKDIR /app
|
||
|
COPY . .
|
||
|
COPY --from=cacher /app/target target
|
||
|
RUN cargo build --release --bin innernet
|
||
|
|
||
|
####################################################################################################
|
||
|
## Final image
|
||
|
####################################################################################################
|
||
|
FROM ubuntu:latest
|
||
|
RUN apt-get update && apt-get install -y libsqlite3-dev iproute2 iputils-ping && rm -rf /var/lib/apt/lists/*
|
||
|
|
||
|
WORKDIR /app
|
||
|
|
||
|
|
||
|
COPY ./docker-tests/start-client.sh ./
|
||
|
COPY --from=builder /app/target/release/innernet /usr/bin/
|
||
|
|
||
|
CMD ["/app/start-client.sh"]
|