Initial Release

This commit is contained in:
Deon George 2017-05-25 23:29:15 +10:00
commit 1f640e2ce1
3 changed files with 85 additions and 0 deletions

41
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,41 @@
image: docker:latest
stages:
- test
- build
variables:
VERSION: php70
DOCKER_IMAGE: leenooks/lamps
DOCKER_REGISTRY: registry.leenooks.net
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services:
- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind
before_script:
- docker info
- docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${DOCKER_IMAGE}:${VERSION} .
- docker images
only:
- debug
build:
stage: build
script:
- chmod 500 init
- docker build -t ${DOCKER_IMAGE}:${VERSION} .
- docker tag ${DOCKER_IMAGE}:${VERSION} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION}
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION}
tags:
- docker
only:
- master

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
# NAME leenooks/ldap
# VERSION latest
# BUILD docker build -t="leenooks/ldap" .
# SETUP docker run --rm=true -v /srv/ldap/openldap/data:/data leenooks/ldap cp -p /var/lib/ldap/DB_CONFIG /data/
# SETUP docker run --rm=true -v /srv/ldap/openldap/data:/var/lib/ldap leenooks/ldap slapadd -l /var/lib/ldap/graytech.ldif
# START docker run ...
FROM registry.leenooks.net/leenooks/base:7
RUN yum -y install tsmpipe && yum clean all
# EPEL & Leenooks packages
RUN yum -y install ln-openldap-server && yum clean all
EXPOSE 389
# Starting
COPY init /sbin/
ENTRYPOINT [ "/sbin/init" ]
CMD [ "start" ]
RUN for i in cosine inetorgperson nis misc samba wurley; do su ldap -s /bin/bash -c "slapadd -l /etc/openldap/schema/$i.ldif -n 0"; done
RUN cd /etc/openldap/slapd.d/cn=config && for i in olcDatabase={2}hdb.ldif; do rm -f $i; done && for i in olcDatabase={2}bdb.ldif; do ln -s /etc/.ln/openldap/slapd.d/cn=config/$i; done

21
init Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
NAME="OPENLDAP"
function stop {
echo "Stopping ${NAME}"
kill $(cat /var/run/openldap/slapd.pid)
}
trap 'stop' SIGTERM
if [ "$1" == "start" ]; then
SLAPD_URLS="ldapi:/// ldap:/// ldaps:///"
SLAPD_OPTIONS="-d 256"
[ -x /usr/sbin/slapd ] && /usr/sbin/slapd -u ldap -h "${SLAPD_URLS}" $SLAPD_OPTIONS &
wait
else
exec $@
fi