This commit is contained in:
Dominic Grimm 2023-01-17 06:54:45 +01:00
parent f614e606f4
commit a177f2a5d4
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530
22 changed files with 1339 additions and 667 deletions

View file

@ -1,26 +1,27 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.65.0 as chef
WORKDIR /usr/src/backend
FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1.65.0 as chef
FROM chef as diesel
RUN cargo install diesel_cli --no-default-features --features postgres
FROM chef as planner
WORKDIR /usr/src/backend
RUN mkdir src && touch src/main.rs
COPY ./Cargo.toml ./Cargo.lock ./
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
WORKDIR /usr/src/backend
COPY --from=planner /usr/src/backend/recipe.json .
RUN cargo chef cook --release --recipe-path recipe.json
COPY ./src ./src
RUN cargo build --release
FROM chef as diesel
RUN cargo install diesel_cli --no-default-features --features postgres
FROM debian:buster-slim as runner
FROM docker.io/debian:bullseye-slim as runner
RUN apt update
RUN apt install -y libpq5
RUN apt install -y ca-certificates
RUN apt-get clean
RUN apt-get autoremove --yes
RUN apt-get autoremove -y
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/
WORKDIR /usr/local/bin
COPY --from=diesel /usr/local/cargo/bin/diesel .