Add docker files
This commit is contained in:
parent
9a2a809677
commit
4f353a47d9
3 changed files with 62 additions and 0 deletions
25
.gitlab-ci.yml
Normal file
25
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
docker-build:
|
||||||
|
image: docker:latest
|
||||||
|
stage: build
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
before_script:
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
|
# Default branch leaves tag empty (= latest tag)
|
||||||
|
# All other branches are tagged with the escaped branch name (commit ref slug)
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||||
|
tag=""
|
||||||
|
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||||
|
else
|
||||||
|
tag=":$CI_COMMIT_REF_SLUG"
|
||||||
|
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||||
|
fi
|
||||||
|
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
||||||
|
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
||||||
|
# Run this job in a branch where a Dockerfile exists
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
exists:
|
||||||
|
- Dockerfile
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update && apt-get install --no-install-recommends -y slapd fusiondirectory-schema fusiondirectory-plugin-mail-schema ldap-utils
|
||||||
|
ENV DEBIAN_FRONTEND=readline
|
||||||
|
RUN rm -rf /etc/ldap/slapd.d/* /var/lib/ldap/*
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 389 636
|
||||||
|
|
||||||
|
ENV URL="ldap:/// ldapi:///"
|
||||||
|
ENV CONF_DIR="/etc/ldap/slapd.d"
|
||||||
|
ENV DB_DIR="/var/lib/ldap"
|
||||||
|
ENV DEBUG_LEVEL="0"
|
||||||
|
|
||||||
|
COPY ./start.sh /root/start.sh
|
||||||
|
RUN chmod +x /root/start.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/root/start.sh"]
|
18
start.sh
Normal file
18
start.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$(ls -A "$CONF_DIR")" ] || [ -z "$(ls -A "$DB_DIR")" ]; then
|
||||||
|
echo "Reconfigure slapd"
|
||||||
|
dpkg-reconfigure -plow slapd
|
||||||
|
|
||||||
|
echo "Insert fusiondirectory schema"
|
||||||
|
slapd -F "$CONF_DIR" -u openldap -g openldap -h "$URL" -d "$DEBUG_LEVEL" &
|
||||||
|
slapd_pid=$!
|
||||||
|
sleep 2
|
||||||
|
fusiondirectory-insert-schema
|
||||||
|
kill -9 "$slapd_pid"
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting slapd"
|
||||||
|
slapd -F "$CONF_DIR" -u openldap -g openldap -h "$URL" -d "$DEBUG_LEVEL"
|
||||||
|
echo "Slapd exited with code $?"
|
Loading…
Reference in a new issue