43 lines
1.3 KiB
Docker
43 lines
1.3 KiB
Docker
FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1.65.0 as chef
|
|
|
|
FROM chef as planner
|
|
WORKDIR /usr/src/auth
|
|
RUN mkdir src && touch src/main.rs
|
|
COPY ./Cargo.toml ./Cargo.lock ./
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM alpine as wkhtmltopdf
|
|
WORKDIR /tmp
|
|
RUN wget -O wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb
|
|
|
|
FROM chef as builder
|
|
WORKDIR /tmp
|
|
RUN apt update
|
|
RUN apt install -y xfonts-base xfonts-75dpi
|
|
COPY --from=wkhtmltopdf /tmp/wkhtmltopdf.deb .
|
|
RUN dpkg -i wkhtmltopdf.deb
|
|
RUN rm wkhtmltopdf.deb
|
|
RUN apt-get clean
|
|
RUN apt-get autoremove -y
|
|
WORKDIR /usr/src/auth
|
|
COPY --from=planner /usr/src/auth/recipe.json .
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
COPY ./src ./src
|
|
RUN cargo build --release
|
|
|
|
FROM docker.io/debian:bullseye-slim as runner
|
|
WORKDIR /tmp
|
|
RUN apt update
|
|
RUN apt install -y ca-certificates
|
|
RUN apt install -y wget xfonts-base xfonts-75dpi fontconfig libjpeg62-turbo libx11-6 libxcb1 libxext6 libxrender1
|
|
COPY --from=wkhtmltopdf /tmp/wkhtmltopdf.deb .
|
|
RUN dpkg -i wkhtmltopdf.deb
|
|
RUN rm wkhtmltopdf.deb
|
|
RUN apt-get clean
|
|
RUN apt-get autoremove -y
|
|
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/
|
|
WORKDIR /usr/src/auth
|
|
COPY --from=builder /usr/src/auth/target/release/auth ./bin/auth
|
|
EXPOSE 80
|
|
ENTRYPOINT [ "./bin/auth" ]
|