Compare commits

...

5 Commits

5 changed files with 45 additions and 6 deletions

View File

@@ -14,8 +14,8 @@ INITIALIZED_FLAG = Path("/var/lib/ldap/.initialized")
SLAPD_D = Path("/etc/ldap/slapd.d") SLAPD_D = Path("/etc/ldap/slapd.d")
base_dn = os.environ["LDAP_BASE_DN"] base_dn = os.environ.get("LDAP_BASE_DN") or "dc=example,dc=org"
password = os.environ["LDAP_PASSWORD"] password = os.environ.get("LDAP_PASSWORD") or "changeit"
tls_enabled = os.environ.get("TLS_ENABLED") == "1" tls_enabled = os.environ.get("TLS_ENABLED") == "1"
admin_dn = f"cn=admin,{base_dn}" admin_dn = f"cn=admin,{base_dn}"

5
docker-bake.hcl Normal file
View File

@@ -0,0 +1,5 @@
target "default" {
context = "."
dockerfile = "Dockerfile"
tags = ["registry.koszewscy.waw.pl/openldap:latest"]
}

View File

@@ -1,5 +1,5 @@
LDAP_DOMAIN=example.com LDAP_DOMAIN=example.org
LDAP_BASE_DN=dc=example,dc=com LDAP_BASE_DN=dc=example,dc=org
LDAP_ORG=Example Organization LDAP_ORG=Example Organization
LDAP_PASSWORD=ChangeMe123! LDAP_PASSWORD=changeit
LDAP_ADMIN_PASSWORD=ChangeMe123! LDAP_ADMIN_PASSWORD=changeit

14
scripts/build.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
REPO_DIR="$(git rev-parse --show-toplevel)"
if command -v container 2>/dev/null; then
container build -t "registry.koszewscy.waw.pl/openldap:latest" "$REPO_DIR"
elif command -v docker 2>/dev/null; then
docker buildx bake --file "$REPO_DIR"/scripts/docker-bake.hcl
else
echo "No supported container tool found."
exit 1
fi

20
scripts/run-container.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if command -v container >/dev/null 2>&1; then
container run -d --name ldap \
--env-file ~/app-data/openldap/openldap.env \
-v openldap_data:/var/lib/ldap \
-v openldap_slapd:/etc/ldap/slapd.d \
-v ~/app-data/openldap/certs:/etc/ldap/certs:ro \
-v ~/app-data/openldap/accounts:/bootstrap/accounts:ro \
-v ~/app-data/openldap/backups:/var/backups:rw \
-p 389:389 -p 636:636 \
openldap:latest
else
echo "Error: 'container' command not found. Please install the 'container' CLI tool." >&2
exit 1
fi