-
Notifications
You must be signed in to change notification settings - Fork 1
Initial commit with base Dockerfile, entrypoint and compose. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Base Image | ||
FROM debian:stable-slim | ||
LABEL org.opencontainers.image.authors="Worteks" \ | ||
name="openldap-ltb" | ||
|
||
# Install required binaries | ||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt update && \ | ||
apt upgrade --no-install-recommends -y && \ | ||
apt install --no-install-recommends -y curl && \ | ||
apt install --no-install-recommends -y gpg && \ | ||
apt install --no-install-recommends -y ca-certificates && \ | ||
apt install --no-install-recommends -y wget | ||
|
||
# Openldap-ltb GPG and Repostiory | ||
RUN curl https://ltb-project.org/documentation/_static/RPM-GPG-KEY-LTB-project | gpg --dearmor > /usr/share/keyrings/ltb-project-openldap-archive-keyring.gpg | ||
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/ltb-project-openldap-archive-keyring.gpg] https://ltb-project.org/debian/openldap26/bookworm bookworm main" > /etc/apt/sources.list.d/ltb-project.list | ||
RUN apt update | ||
|
||
# Installing Openldap-ltb | ||
RUN apt install --no-install-recommends -y openldap-ltb && \ | ||
apt install --no-install-recommends -y openldap-ltb-contrib-overlays && \ | ||
apt install --no-install-recommends -y openldap-ltb-mdb-utils && \ | ||
apt install --no-install-recommends -y openldap-ltb-explockout && \ | ||
apt install --no-install-recommends -y ldapvi | ||
|
||
# permissions | ||
RUN chmod +x /usr/local/openldap/sbin/slapd-cli | ||
RUN chmod 600 /usr/local/openldap/etc/openldap/slapd-cli.conf | ||
RUN chmod 600 /usr/local/openldap/etc/openldap/lload.conf | ||
|
||
# add to $PATH | ||
ENV PATH=/usr/local/openldap/bin:/usr/local/openldap/sbin:$PATH | ||
ENV SLAPD_CONF_DIR=/usr/local/openldap/etc/openldap/slapd.d/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it needed? |
||
|
||
# add slapd customisation | ||
RUN sed "s/SLAPD_CONF_DIR=\"\"/SLAPD_CONF_DIR=\"\$SLAPD_PATH\/etc\/openldap\/slapd.d\"/g" -i /usr/local/openldap/etc/openldap/slapd-cli.conf | ||
|
||
# Set working directory | ||
WORKDIR /usr/local/openldap | ||
|
||
# Clean up | ||
RUN echo "# Clean up image" && \ | ||
rm -rf /tmp/* && \ | ||
apt clean && \ | ||
apt autoremove --yes && \ | ||
rm -rf /var/lib/{apt,dpkg,cache,log}/ | ||
|
||
# Mount locations | ||
VOLUME /usr/local/openldap/etc/openldap/slapd.d | ||
VOLUME /usr/local/openldap/var/openldap-data | ||
|
||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
RUN chmod +x /docker-entrypoint.sh | ||
ENTRYPOINT ["/docker-entrypoint.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# openldap-docker | ||
Docker image for OpenLDAP LTB | ||
|
||
## Build the image locally | ||
``` | ||
docker buildx build -t openldap-ltb . | ||
``` | ||
|
||
## Deploy the container | ||
``` | ||
docker compose up -d | ||
``` | ||
|
||
## Check the container status and logs | ||
``` | ||
docker ps -a | ||
docker logs -f openldap-ltb | ||
``` | ||
|
||
## Community images | ||
https://hub.docker.com/u/ltbproject/openldap-ltb |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
services: | ||
openldap-ltb: | ||
image: openldap-ltb | ||
container_name: openldap-ltb | ||
ports: | ||
- '389:389' | ||
- '636:636' | ||
volumes: | ||
- ./openldap-ltb/schema:/usr/local/openldap/etc/openldap/slapd.d | ||
- ./openldap-ltb/data:/usr/local/openldap/var/openldap-data |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# permission issue | ||
chmod 777 /usr/local/openldap/etc/openldap/slapd.d /usr/local/openldap/var/openldap-data | ||
|
||
# import config and data | ||
slapd-cli importldifconfigtemplate | ||
slapd-cli importdatatemplate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will break existing conf and data |
||
|
||
# start process | ||
slapd-cli debug start | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be run in foreground, either with slapd-cli debug, either with slapd command line |
||
# tail /dev/null | ||
tail -f /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slapd-cli is included in Debian packages, you don't have to install it