feat: use entrypoint for starting docker container

This commit is contained in:
Aravinth Manivannan 2022-05-24 20:31:50 +05:30
parent d8cd8db857
commit 99ddee7e8c
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 17 additions and 5 deletions

View file

@ -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" ]

12
scripts/entrypoint.sh Normal file
View file

@ -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