2021-04-19 12:56:18 +00:00
|
|
|
####################################################################################################
|
|
|
|
## Builder
|
|
|
|
####################################################################################################
|
|
|
|
FROM rust as planner
|
2021-04-20 16:11:20 +00:00
|
|
|
RUN apt-get update && apt-get install -y build-essential musl-tools musl-dev clang libclang-dev libsqlite3-dev
|
2021-04-19 12:56:18 +00:00
|
|
|
RUN update-ca-certificates
|
|
|
|
WORKDIR /app
|
|
|
|
RUN cargo install cargo-chef
|
|
|
|
COPY . .
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
|
|
|
FROM rust as cacher
|
2021-04-20 16:11:20 +00:00
|
|
|
RUN apt-get update && apt-get install -y build-essential musl-tools musl-dev clang libclang-dev libsqlite3-dev
|
2021-04-19 12:56:18 +00:00
|
|
|
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
|
2021-04-20 16:11:20 +00:00
|
|
|
RUN apt-get update && apt-get install -y build-essential musl-tools musl-dev clang libclang-dev libsqlite3-dev
|
2021-04-19 12:56:18 +00:00
|
|
|
RUN update-ca-certificates
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
COPY --from=cacher /app/target target
|
|
|
|
RUN cargo build --release --bin innernet
|
2021-04-20 16:11:20 +00:00
|
|
|
RUN strip /app/target/release/innernet
|
2021-04-19 12:56:18 +00:00
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
## 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"]
|