Update dockerfile

This commit is contained in:
Marisa 2025-11-12 11:17:18 -05:00
parent 960870bcd1
commit 5ca1cc0516

View File

@ -3,7 +3,7 @@ FROM ubuntu:22.04
# set non-interactive TERM for docker
ENV DEBIAN_FRONTEND=noninteractive
# install slapd and ldap-utils
# install slapd, ldap-utils, and packages needed for ldapdock to work
RUN apt-get update && apt-get install -y --no-install-recommends \
slapd ldap-utils gnutls-bin ssl-cert ca-certificates schema2ldif vim mc && apt-get clean
@ -18,16 +18,19 @@ RUN echo "slapd slapd/password1 password admin" | debconf-set-selections && \
# make use of debconf-set-selections
RUN dpkg-reconfigure -f noninteractive slapd
# create a script to automatically start slapd while this dockerfile is being parsed
COPY ./start-slapd.sh ./start-slapd.sh
RUN chmod +x ./start-slapd.sh
# copy newest entrypoint.sh and run it
COPY entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
# open up LDAP simple port
EXPOSE 389
EXPOSE 636
# set salvable volumes for LDAP data, configuration
#VOLUME ["/var/lib/ldap", "/etc/ldap/slapd.d"]
# Create directory for exporting certs to host
RUN mkdir -p /export-certs
# set salvable volumes for LDAP data, configuration, certs
VOLUME ["/var/lib/ldap", "/etc/ldap/slapd.d", "/etc/ldap/certs","/export-certs"]
# set correct permissions for openldap user
RUN chown -R openldap:openldap /var/lib/ldap /etc/ldap/slapd.d
@ -37,12 +40,3 @@ ENTRYPOINT ["./entrypoint.sh"]
# CMD provides the default command (/bin/bash) which is passed as an argument to the ENTRYPOINT script
CMD ["/bin/bash"]
### optional use ###
# start slapd
#CMD ["slapd", "-h", "ldap:/// ldapi:///", "-g", "openldap", "-u", "openldap", "-F", "/etc/ldap/slapd.d"]
#
# set entrypoint
#ENTRYPOINT ["/entrypoint.sh"]
#CMD ["bash"]
# run img container with 'docker run -i -t -v ldap_data:/var/lib/ldap -v ldap_config:/etc/ldap/slapd.d ldapdock' for interactive shell