bot-mastodon-image-uploader/Dockerfile

42 lines
845 B
Docker
Raw Permalink Normal View History

2023-12-08 12:29:23 +00:00
# syntax=docker/dockerfile:1
2024-12-03 12:01:42 +00:00
FROM rust:1.83.0-slim-bullseye AS deps
2024-12-03 11:53:03 +00:00
RUN apt update && apt install pkg-config openssl libssl-dev -y
2023-12-08 12:29:23 +00:00
WORKDIR /app
2024-12-03 11:53:03 +00:00
COPY src src
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
2024-11-29 15:49:59 +00:00
2024-12-03 11:53:03 +00:00
FROM deps AS test
COPY .cargo .cargo
COPY config.toml config.toml
COPY mastodon-data.toml mastodon-data.toml
RUN cargo build
2024-11-29 15:49:59 +00:00
2024-12-03 11:53:03 +00:00
FROM deps AS build
ARG APP_NAME=mastodon-image-uploader-bot
WORKDIR /app
RUN <<EOF
2023-12-08 12:29:23 +00:00
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-12-03 11:53:03 +00:00
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
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"]