bot-mastodon-image-uploader/Dockerfile

35 lines
793 B
Docker
Raw Normal View History

2023-12-08 12:29:23 +00:00
# syntax=docker/dockerfile:1
2024-11-29 14:44:39 +00:00
FROM rust:1.79.0-slim-bullseye AS build
2023-12-08 12:29:23 +00:00
WORKDIR /app
2024-11-29 15:49:59 +00:00
ARG APP_NAME=mastodon-image-uploader-bot
RUN apt update && apt install pkg-config openssl libssl-dev -y
2024-11-29 15:49:59 +00:00
2023-12-08 12:29:23 +00:00
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
2024-11-29 15:49:59 +00:00
ls ./target/release/$APP_NAME
2023-12-08 12:29:23 +00:00
cp ./target/release/$APP_NAME /bin/bot
EOF
FROM debian:bullseye-slim AS final
WORKDIR /app
2024-02-23 18:47:54 +00:00
RUN apt update && apt install pkg-config openssl libssl-dev curl -y
2024-11-29 15:49:59 +00:00
2023-12-08 12:29:23 +00:00
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"]