bot-mastodon-image-uploader/Dockerfile

35 lines
793 B
Docker

# syntax=docker/dockerfile:1
FROM rust:1.82.0-slim-bullseye AS build
WORKDIR /app
ARG APP_NAME=mastodon-image-uploader-bot
RUN apt update && apt install pkg-config openssl libssl-dev -y
RUN --mount=type=bind,source=src,target=src \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
<<EOF
set -e
cargo build --locked --release
ls ./target/release/$APP_NAME
cp ./target/release/$APP_NAME /bin/bot
EOF
FROM debian:bullseye-slim AS final
WORKDIR /app
RUN apt update && apt install pkg-config openssl libssl-dev curl -y
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--shell "/sbin/nologin" \
--uid "${UID}" \
botuser
USER botuser
COPY --from=build /bin/bot /bin/
CMD ["/bin/bot"]