Dockerfile 2.7 KB

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