# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

FROM rust:latest as rust
WORKDIR /src
RUN apt update && apt-get install -y --no-install-recommends protobuf-compiler
COPY . .
RUN cargo build --release

FROM debian:bookworm as dcache
LABEL org.opencontainers.image.source https://git.batsense.net/mcaptcha/dcache
RUN useradd -ms /bin/bash -u 1001 dcache
WORKDIR /home/dcache
COPY --from=rust /src/target/release/main /usr/local/bin/dcache
#COPY --from=rust /src/config/default.toml /etc/dcache/config.toml
USER dcache
CMD [ "/usr/local/bin/dcache" ]
