Update: Dockerfile && Move configuration to entrypoint
This commit is contained in:
parent
e37dc23961
commit
1fed83f3c0
41
Dockerfile
41
Dockerfile
@ -1,11 +1,20 @@
|
|||||||
FROM debian:stable-slim
|
|
||||||
|
|
||||||
ARG LDAP_ADMIN_PASSWORD
|
ARG LDAP_ADMIN_PASSWORD
|
||||||
ARG LDAP_DOMAIN
|
ARG LDAP_DOMAIN
|
||||||
ARG LDAP_ORGANISATION
|
ARG LDAP_ORGANISATION
|
||||||
ARG LDAP_USER
|
ARG LDAP_USER
|
||||||
ARG LDAP_GROUP
|
ARG LDAP_GROUP
|
||||||
|
|
||||||
|
FROM debian:stable-slim
|
||||||
|
|
||||||
|
ARG LDAP_ADMIN_PASSWORD
|
||||||
|
ARG LDAP_DOMAIN
|
||||||
|
ARG LDAP_ORGANISATION
|
||||||
|
ARG LDAP_USER=1000
|
||||||
|
ARG LDAP_GROUP=1000
|
||||||
|
|
||||||
|
ARG UID=1000
|
||||||
|
ARG GID=1000
|
||||||
|
|
||||||
ENV LDAP_ADMIN_PASSWORD $LDAP_ADMIN_PASSWORD
|
ENV LDAP_ADMIN_PASSWORD $LDAP_ADMIN_PASSWORD
|
||||||
ENV LDAP_ORGANISATION $LDAP_ORGANISATION
|
ENV LDAP_ORGANISATION $LDAP_ORGANISATION
|
||||||
ENV LDAP_DOMAIN $LDAP_DOMAIN
|
ENV LDAP_DOMAIN $LDAP_DOMAIN
|
||||||
@ -14,24 +23,26 @@ ENV LDAP_GROUP $LDAP_GROUP
|
|||||||
|
|
||||||
RUN apt-get update -y && apt dist-upgrade -y
|
RUN apt-get update -y && apt dist-upgrade -y
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y slapd ldap-utils
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y slapd ldap-utils ca-certificates
|
||||||
|
|
||||||
RUN usermod -u ${LDAP_USER} openldap && \
|
RUN usermod -u ${UID} openldap && \
|
||||||
groupmod -g ${LDAP_GROUP} openldap
|
groupmod -g ${GID} openldap
|
||||||
|
|
||||||
ADD slapd.sh /opt/slapd
|
ADD slapd.sh /opt/slapd
|
||||||
RUN /opt/slapd
|
|
||||||
|
|
||||||
COPY ./schema/*.ldif ./schema/*.schema /etc/ldap/schema/
|
## Run on entrypoint
|
||||||
|
#RUN /opt/slapd
|
||||||
|
|
||||||
RUN slapcat -n 0 \
|
#COPY ./schema/*.ldif ./schema/*.schema /etc/ldap/schema/
|
||||||
|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 && \
|
#RUN slapcat -n 0 \
|
||||||
rm -rf /etc/ldap/slapd.d/* && \
|
# |sed 's/cn: config/cn: config\nolcPasswordHash: {CRYPT}\nolcPasswordCryptSaltFormat: $6$%.16s/' \
|
||||||
slapadd -n 0 -F /etc/ldap/slapd.d/ -l /tmp/config.ldif && \
|
# |sed 's/cn: module{0}/cn: module{0}\nolcModuleLoad: {0}lastbind/' > /tmp/config.ldif && \
|
||||||
echo "dn: olcOverlay={0}lastbind, olcDatabase={1}mdb,cn=config\nobjectClass: olcLastBindConfig\nolcOverlay: {0}lastbind" | slapadd -n 0 && \
|
# rm -rf /etc/ldap/slapd.d/* && \
|
||||||
slapadd -l /etc/ldap/schema/nextcloud.ldif && \
|
# slapadd -n 0 -F /etc/ldap/slapd.d/ -l /tmp/config.ldif && \
|
||||||
rm /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
|
||||||
|
|
||||||
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/ && \
|
||||||
|
@ -5,24 +5,14 @@ volumes:
|
|||||||
services:
|
services:
|
||||||
admin:
|
admin:
|
||||||
image: registry.audio-lab.org/ldapphpadmin
|
image: registry.audio-lab.org/ldapphpadmin
|
||||||
restart: always
|
|
||||||
links:
|
|
||||||
- ldap
|
|
||||||
ports:
|
|
||||||
- ${LDAP_ADMIN_PORT}:80
|
|
||||||
build:
|
build:
|
||||||
context: phpldapadmin
|
context: phpldapadmin
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- LDAP_BASE=${LDAP_BASE}
|
- LDAP_BASE=${LDAP_BASE}
|
||||||
ldap:
|
ldap:
|
||||||
user: ${USER_GROUP}
|
|
||||||
image: registry.audio-lab.org/ldap
|
image: registry.audio-lab.org/ldap
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
|
||||||
- ${LDAP_PORT}:389
|
|
||||||
volumes:
|
|
||||||
- data:/var/lib/ldap
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@ -32,7 +22,3 @@ services:
|
|||||||
- LDAP_DOMAIN=${LDAP_DOMAIN}
|
- LDAP_DOMAIN=${LDAP_DOMAIN}
|
||||||
- LDAP_USER=${LDAP_USER}
|
- LDAP_USER=${LDAP_USER}
|
||||||
- LDAP_GROUP=${LDAP_GROUP}
|
- LDAP_GROUP=${LDAP_GROUP}
|
||||||
environment:
|
|
||||||
- LDAP_ADMIN_PASSWORD=${LDAP_ADMIN_PASSWORD}
|
|
||||||
- LDAP_ORGANISATION=${LDAP_ORGANISATION}
|
|
||||||
- LDAP_DOMAIN=${LDAP_DOMAIN}
|
|
||||||
|
38
docker-compose.yml.example
Normal file
38
docker-compose.yml.example
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
version: "2.4"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
services:
|
||||||
|
admin:
|
||||||
|
image: registry.audio-lab.org/ldapphpadmin
|
||||||
|
restart: always
|
||||||
|
links:
|
||||||
|
- ldap
|
||||||
|
ports:
|
||||||
|
- ${LDAP_ADMIN_PORT}:80
|
||||||
|
build:
|
||||||
|
context: phpldapadmin
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
- LDAP_BASE=${LDAP_BASE}
|
||||||
|
ldap:
|
||||||
|
user: ${USER_GROUP}
|
||||||
|
image: registry.audio-lab.org/ldap
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- ${LDAP_PORT}:389
|
||||||
|
volumes:
|
||||||
|
- data:/var/lib/ldap
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
- LDAP_ADMIN_PASSWORD=${LDAP_ADMIN_PASSWORD}
|
||||||
|
- LDAP_ORGANISATION=${LDAP_ORGANISATION}
|
||||||
|
- LDAP_DOMAIN=${LDAP_DOMAIN}
|
||||||
|
- LDAP_USER=${LDAP_USER}
|
||||||
|
- LDAP_GROUP=${LDAP_GROUP}
|
||||||
|
environment:
|
||||||
|
- LDAP_ADMIN_PASSWORD=${LDAP_ADMIN_PASSWORD}
|
||||||
|
- LDAP_ORGANISATION=${LDAP_ORGANISATION}
|
||||||
|
- LDAP_DOMAIN=${LDAP_DOMAIN}
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
RUN slapadd -n 0 -l /etc/ldap/schema/domain.ldif
|
/opt/slapd
|
||||||
|
|
||||||
|
slapadd -n 0 -l /etc/ldap/schema/domain.ldif
|
||||||
|
|
||||||
exec $@
|
exec $@
|
||||||
|
4
slapd.sh
4
slapd.sh
@ -16,8 +16,8 @@ slapd slapd/internal/adminpw password ${LDAP_ADMIN_PASSWORD}
|
|||||||
slapd slapd/password2 password ${LDAP_ADMIN_PASSWORD}
|
slapd slapd/password2 password ${LDAP_ADMIN_PASSWORD}
|
||||||
slapd slapd/password1 password ${LDAP_ADMIN_PASSWORD}
|
slapd slapd/password1 password ${LDAP_ADMIN_PASSWORD}
|
||||||
slapd slapd/dump_database_destdir string /var/backups/slapd-VERSION
|
slapd slapd/dump_database_destdir string /var/backups/slapd-VERSION
|
||||||
slapd slapd/domain string ${LDAP_DOMAIN}
|
slapd slapd/domain string "${LDAP_DOMAIN}"
|
||||||
slapd shared/organization string ${LDAP_ORGANISATION}
|
slapd shared/organization string "${LDAP_ORGANISATION}"
|
||||||
slapd slapd/backend string HDB
|
slapd slapd/backend string HDB
|
||||||
slapd slapd/purge_database boolean true
|
slapd slapd/purge_database boolean true
|
||||||
slapd slapd/move_old_database boolean true
|
slapd slapd/move_old_database boolean true
|
||||||
|
Loading…
Reference in New Issue
Block a user