ezidam/Dockerfile

29 lines
996 B
Docker

FROM clux/muslrust:stable as chef
USER root
RUN cargo install cargo-chef
WORKDIR /ezidam
FROM chef AS planner
COPY Cargo.toml .
COPY Cargo.lock .
COPY crates crates
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /ezidam/recipe.json recipe.json
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
COPY --from=planner /ezidam/Cargo.toml .
COPY --from=planner /ezidam/Cargo.lock .
COPY --from=planner /ezidam/crates crates
COPY logo logo
RUN cargo build --release --target x86_64-unknown-linux-musl --package ezidam --bin ezidam
FROM alpine:3.17.2
COPY --from=builder /ezidam/target/x86_64-unknown-linux-musl/release/ezidam /usr/bin/ezidam
COPY crates/ezidam/static /usr/share/ezidam/static
COPY crates/ezidam/templates /usr/share/ezidam/templates
COPY crates/email/templates /usr/share/ezidam/email-templates
EXPOSE 8000
ENTRYPOINT ["/usr/bin/ezidam"]
LABEL maintainer="Philippe Loctaux <p@philippeloctaux.com>"