FROM rust RUN useradd -m piper WORKDIR /piper RUN chown piper /piper USER piper ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse COPY --chown=piper Cargo.toml Cargo.lock ./ RUN mkdir src && touch src/lib.rs && cargo b -r && rm src/lib.rs COPY --chown=piper src/ src/ RUN cargo install --offline --path . RUN mkdir -p ~/.config/piper-bot && ln -s /mnt/config.kdl ~/.config/piper-bot/config.kdl CMD /usr/local/cargo/bin/piper-bot