mirror of
https://github.com/lldap/lldap.git
synced 2024-11-25 09:06:03 +00:00
docker: Add support for UID:GID
Adds support for the UID/GID env variables in Docker via `gosu`.
This commit is contained in:
parent
9a869a1474
commit
46546dac27
3 changed files with 13 additions and 5 deletions
3
.github/workflows/Dockerfile.ci
vendored
3
.github/workflows/Dockerfile.ci
vendored
|
@ -56,13 +56,12 @@ ENV UID=1000
|
|||
ENV GID=1000
|
||||
ENV USER=lldap
|
||||
RUN apt update && \
|
||||
apt install -y --no-install-recommends tini ca-certificates && \
|
||||
apt install -y --no-install-recommends tini ca-certificates gosu && \
|
||||
apt clean && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
groupadd -g $GID $USER && useradd --system -m -g $USER --uid $UID $USER
|
||||
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /lldap /app
|
||||
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /docker-entrypoint.sh /docker-entrypoint.sh
|
||||
WORKDIR /app
|
||||
USER $USER
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
CMD ["run", "--config-file", "/data/lldap_config.toml"]
|
||||
|
|
4
.github/workflows/Dockerfile.ci.alpine
vendored
4
.github/workflows/Dockerfile.ci.alpine
vendored
|
@ -56,7 +56,8 @@ WORKDIR /app
|
|||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
ENV USER=lldap
|
||||
RUN apk add --no-cache tini ca-certificates bash && \
|
||||
RUN echo http://mirror.math.princeton.edu/pub/alpinelinux/edge/testing/ >> /etc/apk/repositories && \
|
||||
apk add --no-cache tini ca-certificates bash gosu && \
|
||||
addgroup -g $GID $USER && \
|
||||
adduser \
|
||||
--disabled-password \
|
||||
|
@ -69,6 +70,5 @@ RUN apk add --no-cache tini ca-certificates bash && \
|
|||
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /lldap /app
|
||||
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /docker-entrypoint.sh /docker-entrypoint.sh
|
||||
WORKDIR /app
|
||||
USER $USER
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
CMD ["run", "--config-file", "/data/lldap_config.toml"]
|
||||
|
|
|
@ -35,4 +35,13 @@ if [[ ! -r "$CONFIG_FILE" ]]; then
|
|||
exit 1;
|
||||
fi
|
||||
|
||||
exec /app/lldap "$@"
|
||||
echo "> Setup permissions.."
|
||||
find /app \! -user "$UID" -exec chown "$UID:$GID" '{}' +
|
||||
find /data \! -user "$UID" -exec chown "$UID:$GID" '{}' +
|
||||
|
||||
|
||||
echo "> Starting lldap.."
|
||||
echo ""
|
||||
exec gosu "$UID:$GID" /app/lldap "$@"
|
||||
|
||||
exec "$@"
|
||||
|
|
Loading…
Reference in a new issue