mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +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
.github/workflows/Dockerfile.ci
vendored
3
.github/workflows/Dockerfile.ci
vendored
@ -56,13 +56,12 @@ ENV UID=1000
|
|||||||
ENV GID=1000
|
ENV GID=1000
|
||||||
ENV USER=lldap
|
ENV USER=lldap
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt install -y --no-install-recommends tini ca-certificates && \
|
apt install -y --no-install-recommends tini ca-certificates gosu && \
|
||||||
apt clean && \
|
apt clean && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
groupadd -g $GID $USER && useradd --system -m -g $USER --uid $UID $USER
|
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 /lldap /app
|
||||||
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /docker-entrypoint.sh /docker-entrypoint.sh
|
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
USER $USER
|
|
||||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||||
CMD ["run", "--config-file", "/data/lldap_config.toml"]
|
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 UID=1000
|
||||||
ENV GID=1000
|
ENV GID=1000
|
||||||
ENV USER=lldap
|
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 && \
|
addgroup -g $GID $USER && \
|
||||||
adduser \
|
adduser \
|
||||||
--disabled-password \
|
--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 /lldap /app
|
||||||
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /docker-entrypoint.sh /docker-entrypoint.sh
|
COPY --from=lldap --chown=$CONTAINERUSER:$CONTAINERUSER /docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
USER $USER
|
|
||||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||||
CMD ["run", "--config-file", "/data/lldap_config.toml"]
|
CMD ["run", "--config-file", "/data/lldap_config.toml"]
|
||||||
|
@ -35,4 +35,13 @@ if [[ ! -r "$CONFIG_FILE" ]]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
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 New Issue
Block a user