feat: use entrypoint for starting docker container
This commit is contained in:
parent
d8cd8db857
commit
99ddee7e8c
2 changed files with 17 additions and 5 deletions
10
Dockerfile
10
Dockerfile
|
@ -30,11 +30,11 @@ WORKDIR /src
|
||||||
COPY . /src/
|
COPY . /src/
|
||||||
RUN make release
|
RUN make release
|
||||||
|
|
||||||
FROM debian:bullseye
|
FROM debian:bullseye-slim
|
||||||
LABEL org.opencontainers.image.source https://github.com/forgeflux-org/starchart
|
LABEL org.opencontainers.image.source https://github.com/forgeflux-org/starchart
|
||||||
RUN useradd -ms /bin/bash -u 1001 starchart
|
RUN apt-get update && apt-get install -y ca-certificates
|
||||||
WORKDIR /home/mcaptcha
|
|
||||||
COPY --from=rust /src/target/release/starchart /usr/local/bin/
|
COPY --from=rust /src/target/release/starchart /usr/local/bin/
|
||||||
COPY --from=rust /src/config/default.toml /etc/starchart/config.toml
|
COPY --from=rust /src/config/default.toml /etc/starchart/config.toml
|
||||||
USER starchart
|
COPY scripts/entrypoint.sh /usr/local/bin
|
||||||
CMD [ "/usr/local/bin/starchart" ]
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
|
CMD [ "/usr/local/bin/entrypoint.sh" ]
|
||||||
|
|
12
scripts/entrypoint.sh
Normal file
12
scripts/entrypoint.sh
Normal 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
|
Loading…
Reference in a new issue