Dockerfile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Use osixia/light-baseimage
  2. # sources: https://github.com/osixia/docker-light-baseimage
  3. FROM osixia/light-baseimage:1.1.1
  4. MAINTAINER Bertrand Gouny <[email protected]>
  5. ARG LDAP_OPENLDAP_GID
  6. ARG LDAP_OPENLDAP_UID
  7. # Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
  8. # If explicit uid or gid is given, use it.
  9. RUN if [ -z "${LDAP_OPENLDAP_GID}" ]; then groupadd -r openldap; else groupadd -r -g ${LDAP_OPENLDAP_GID} openldap; fi \
  10. && if [ -z "${LDAP_OPENLDAP_UID}" ]; then useradd -r -g openldap openldap; else useradd -r -g openldap -u ${LDAP_OPENLDAP_UID} openldap; fi
  11. # Add stretch-backports in preparation for downloading newer openldap components, especially sladp
  12. RUN echo "deb http://ftp.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
  13. # Install OpenLDAP, ldap-utils and ssl-tools from the (backported) baseimage and clean apt-get files
  14. # sources: https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/add-service-available
  15. #  https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/:ssl-tools/download.sh
  16. RUN echo "path-include /usr/share/doc/krb5*" >> /etc/dpkg/dpkg.cfg.d/docker && apt-get -y update \
  17. && /container/tool/add-service-available :ssl-tools \
  18. && LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get -t stretch-backports install -y --no-install-recommends \
  19. ldap-utils \
  20. libsasl2-modules \
  21. libsasl2-modules-db \
  22. libsasl2-modules-gssapi-mit \
  23. libsasl2-modules-ldap \
  24. libsasl2-modules-otp \
  25. libsasl2-modules-sql \
  26. openssl \
  27. slapd \
  28. krb5-kdc-ldap \
  29. && apt-get clean \
  30. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  31. # Add service directory to /container/service
  32. ADD service /container/service
  33. # Use baseimage install-service script
  34. # https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service
  35. RUN /container/tool/install-service
  36. # Add default env variables
  37. ADD environment /container/environment/99-default
  38. # Expose default ldap and ldaps ports
  39. EXPOSE 389 636
  40. # Put ldap config and database dir in a volume to persist data.
  41. # VOLUME /etc/ldap/slapd.d /var/lib/ldap