From 99ddee7e8cdcbe9b8bedbf400a76efc5aa452b9a Mon Sep 17 00:00:00 2001 From: realaravinth Date: Tue, 24 May 2022 20:31:50 +0530 Subject: [PATCH] feat: use entrypoint for starting docker container --- Dockerfile | 10 +++++----- scripts/entrypoint.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 scripts/entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 65e76c8..d2c7c44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,11 +30,11 @@ WORKDIR /src COPY . /src/ RUN make release -FROM debian:bullseye +FROM debian:bullseye-slim LABEL org.opencontainers.image.source https://github.com/forgeflux-org/starchart -RUN useradd -ms /bin/bash -u 1001 starchart -WORKDIR /home/mcaptcha +RUN apt-get update && apt-get install -y ca-certificates COPY --from=rust /src/target/release/starchart /usr/local/bin/ COPY --from=rust /src/config/default.toml /etc/starchart/config.toml -USER starchart -CMD [ "/usr/local/bin/starchart" ] +COPY scripts/entrypoint.sh /usr/local/bin +RUN chmod +x /usr/local/bin/entrypoint.sh +CMD [ "/usr/local/bin/entrypoint.sh" ] diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100644 index 0000000..f9412ae --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +readonly username=starchart +USER_ID=${LOCAL_USER_ID} +echo "[*] Local user ID: $USER_ID" +echo "[*] Starting with UID : $USER_ID" +export HOME=/home/$username +#adduser --disabled-password --shell /bin/bash --home $HOME --uid $USER_ID user +#--uid +useradd --uid $USER_ID -b /home -m -s /bin/bash $username +su - $username +starchart