From c2ddb4a738dfea1bf6b1e9705a84c4b6922f6f84 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Thu, 14 Mar 2024 12:27:44 +0100 Subject: [PATCH] non root user --- Dockerfile | 3 ++- entrypoint.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index b824933..0c4588f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,8 @@ RUN pacman -Sy --noconfirm archlinux-keyring && \ python-mutagen COPY --from=builder /app/target/release/hoard /hoard +COPY ./entrypoint.sh /entrypoint.sh WORKDIR / -CMD ["/hoard"] +CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..835dde2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Creating User ${UID:-1000}" +usermod -u "${UID:-1000}" hoard || exit 1 + +chown -R hoard /downloads +mkdir /.cache && chown -R hoard /.cache +chown -R hoard /download.db + +su hoard -c /hoard