Skip to content

Commit e363594

Browse files
committed
Include the client-side CLI utils in the image
The image can now be used to run an ldap client command rather than the slapd server. If so, skip slapd-specific configuration and setup logic and do not require the environment variables used by this setup. This approach is inspired by other Docker entrypoint scripts used for initial setup such as in the Docker Hub-official MySQL and Postgres images, but uses an alternative exit point for the script instead of an if clause that spans most of the logic.
1 parent cfad581 commit e363594

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ MAINTAINER Fedde Schaeffer <fedde@thehyve.nl>
44

55
ENV OPENLDAP_VERSION 2.4.44
66

7-
RUN apt-get update && \
8-
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
9-
slapd=${OPENLDAP_VERSION}* && \
10-
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/*
7+
RUN apt-get update \
8+
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
9+
slapd=${OPENLDAP_VERSION}* \
10+
ldap-utils=${OPENLDAP_VERSION}* \
11+
&& apt-get clean \
12+
&& rm -rf /var/lib/apt/lists/*
1213

1314
RUN mv /etc/ldap /etc/ldap.dist
1415

entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ ulimit -n 8192
77

88
set -e
99

10+
# if command starts with an option, prepend slapd
11+
if [ "${1:0:1}" = '-' ]; then
12+
set -- slapd "$@"
13+
fi
14+
15+
# skip setup if running something other than slapd
16+
if [ "$1" != 'slapd' ]; then
17+
exec "$@"
18+
fi
19+
1020
SLAPD_FORCE_RECONFIGURE="${SLAPD_FORCE_RECONFIGURE:-false}"
1121

1222
first_run=true

0 commit comments

Comments
 (0)