29 lines
809 B
Text
29 lines
809 B
Text
|
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
||
|
#
|
||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||
|
FROM rust:latest as planner
|
||
|
RUN cargo install cargo-chef
|
||
|
WORKDIR /src
|
||
|
COPY . /src/
|
||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||
|
|
||
|
FROM rust:latest as cacher
|
||
|
WORKDIR /src/
|
||
|
RUN cargo install cargo-chef
|
||
|
COPY --from=planner /src/recipe.json recipe.json
|
||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||
|
|
||
|
FROM rust:latest as rust
|
||
|
WORKDIR /src
|
||
|
COPY . .
|
||
|
COPY --from=cacher /src/target target
|
||
|
RUN cargo build --release
|
||
|
|
||
|
FROM debian:bullseye as powd
|
||
|
LABEL org.opencontainers.image.source https://git.batsense.net/mcaptcha/powd
|
||
|
RUN useradd -ms /bin/bash -u 1001 powd
|
||
|
WORKDIR /home/powd
|
||
|
COPY --from=rust /src/target/release/powd /usr/local/bin/
|
||
|
USER powd
|
||
|
CMD [ "/usr/local/bin/powd" ]
|