Dockerfile 2.2 KB

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