ldap/Dockerfile
2023-05-17 21:24:59 +10:00

30 lines
1.2 KiB
Docker

# NAME leenooks/ldap
# VERSION latest
FROM alpine
# Change to http respositories, so they we can cache the install packages
RUN if [ -n ${HTTP_PROXY} ] ; then sed -i -e s'/https/http/' /etc/apk/repositories; fi
RUN apk add --no-cache bash openldap openldap-back-mdb openldap-clients openldap-overlay-syncprov
ADD acl.ldif samba.ldif wurley.ldif /etc/openldap/schema/
ADD certinfo.ldif /etc/openldap/
RUN sed -i -e 's/dc=my-domain,dc=com/c=AU/' /etc/openldap/slapd.ldif \
&& sed -i -e 's/openldap-data/data/' /etc/openldap/slapd.ldif \
&& mv /var/lib/openldap/openldap-data /var/lib/openldap/data \
&& mkdir /etc/openldap/slapd.d \
&& slapadd -n 0 -F /etc/openldap/slapd.d -l /etc/openldap/slapd.ldif \
&& slapadd -b cn=config -l /etc/openldap/schema/misc.ldif \
&& slapadd -b cn=config -l /etc/openldap/schema/samba.ldif \
&& slapadd -b cn=config -l /etc/openldap/schema/wurley.ldif \
&& slapmodify -b cn=config -l /etc/openldap/schema/acl.ldif \
&& slapmodify -b cn=config -l /etc/openldap/certinfo.ldif \
&& mkdir /var/lib/openldap/run \
&& chown -R ldap:ldap /etc/openldap/slapd.d /var/lib/openldap/data /var/lib/openldap/run
# Starting
ENTRYPOINT [ "/usr/sbin/slapd" ]
CMD [ "-u","ldap","-h","ldapi:/// ldap:/// ldaps:///","-d","256" ]
EXPOSE 389 636