Add: Volume

This commit is contained in:
Luca 2022-12-14 22:13:58 +01:00
parent 848faa0f36
commit e37dc23961
3 changed files with 11 additions and 11 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.env .env
data

View File

@ -22,24 +22,21 @@ RUN usermod -u ${LDAP_USER} openldap && \
ADD slapd.sh /opt/slapd ADD slapd.sh /opt/slapd
RUN /opt/slapd RUN /opt/slapd
COPY ./schema/*.ldif ./schema/*.schema /etc/ldap/schema/
RUN slapcat -n 0 \ RUN slapcat -n 0 \
|sed 's/cn: config/cn: config\nolcPasswordHash: {CRYPT}\nolcPasswordCryptSaltFormat: $6$%.16s/' \ |sed 's/cn: config/cn: config\nolcPasswordHash: {CRYPT}\nolcPasswordCryptSaltFormat: $6$%.16s/' \
|sed 's/cn: module{0}/cn: module{0}\nolcModuleLoad: {0}lastbind/' > /tmp/config.ldif && \ |sed 's/cn: module{0}/cn: module{0}\nolcModuleLoad: {0}lastbind/' > /tmp/config.ldif && \
rm -rf /etc/ldap/slapd.d/* && \ rm -rf /etc/ldap/slapd.d/* && \
slapadd -n 0 -F /etc/ldap/slapd.d/ -l /tmp/config.ldif && \ slapadd -n 0 -F /etc/ldap/slapd.d/ -l /tmp/config.ldif && \
echo "dn: olcOverlay={0}lastbind, olcDatabase={1}mdb,cn=config\nobjectClass: olcLastBindConfig\nolcOverlay: {0}lastbind" | slapadd -n 0 && \
slapadd -l /etc/ldap/schema/nextcloud.ldif && \
rm /tmp/config.ldif rm /tmp/config.ldif
RUN echo "dn: olcOverlay={0}lastbind, olcDatabase={1}mdb,cn=config\nobjectClass: olcLastBindConfig\nolcOverlay: {0}lastbind" \
| slapadd -n 0
COPY ./schema/*.ldif ./schema/*.schema /etc/ldap/schema/
RUN slapadd -l /etc/ldap/schema/nextcloud.ldif
RUN chmod -R o+rw /etc/ldap/slapd.d/ && \ RUN chmod -R o+rw /etc/ldap/slapd.d/ && \
chmod -R o+rwx /etc/ldap/slapd.d/cn=config/ && \ chmod -R o+rwx /etc/ldap/slapd.d/cn=config/ && \
chmod -R o+rwx /etc/ldap/slapd.d/cn=config/cn=schema/ && \ chmod -R o+rwx /etc/ldap/slapd.d/cn=config/cn=schema/ && \
chmod -R o+rwx /var/lib/ldap && \
chmod -R o+rw /var/run/slapd/ chmod -R o+rw /var/run/slapd/
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@ -53,4 +50,3 @@ ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 389 EXPOSE 389
CMD ["/usr/sbin/slapd","-h", "ldap:///","-d","4"] CMD ["/usr/sbin/slapd","-h", "ldap:///","-d","4"]

View File

@ -1,5 +1,7 @@
version: "2.4" version: "2.4"
volumes:
data:
services: services:
admin: admin:
image: registry.audio-lab.org/ldapphpadmin image: registry.audio-lab.org/ldapphpadmin
@ -19,6 +21,8 @@ services:
restart: always restart: always
ports: ports:
- ${LDAP_PORT}:389 - ${LDAP_PORT}:389
volumes:
- data:/var/lib/ldap
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
@ -32,4 +36,3 @@ services:
- LDAP_ADMIN_PASSWORD=${LDAP_ADMIN_PASSWORD} - LDAP_ADMIN_PASSWORD=${LDAP_ADMIN_PASSWORD}
- LDAP_ORGANISATION=${LDAP_ORGANISATION} - LDAP_ORGANISATION=${LDAP_ORGANISATION}
- LDAP_DOMAIN=${LDAP_DOMAIN} - LDAP_DOMAIN=${LDAP_DOMAIN}