Browse Source

new baseimage

ofreax 10 years ago
parent
commit
18abe3cfc0
4 changed files with 39 additions and 18 deletions
  1. 25 12
      image/Dockerfile
  2. 2 5
      image/service/slapd/container-start.sh
  3. 11 0
      image/service/slapd/install.sh
  4. 1 1
      test/test.bats

+ 25 - 12
image/Dockerfile

@@ -1,23 +1,36 @@
 FROM osixia/light-baseimage:0.1.0
 MAINTAINER Bertrand Gouny <[email protected]>
 
-# Use baseimage-docker's init system.
+# Use osixia/light-baseimage's init system.
 CMD ["/osixia/tool/run"]
 
-# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
-RUN groupadd -r openldap && useradd -r -g openldap openldap
-
-# Install OpenLDAP, ldap-utils and ssl-helper from baseimage, remove default ldap db
-RUN apt-get -y update && /sbin/add-service-available ssl-helper-gnutls \
-	&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends \
-	slapd ldap-utils \
-	&& rm -rf /var/lib/ldap /etc/ldap/slapd.d
-
 # Add service directory to /osixia/service
 ADD service /osixia/service
 
-# Use baseimage install-service script and clean all
-RUN ./sbin/install-service && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+# Scripts /sbin/add-service-available
+# /sbin/install-service and /sbin/clean-container
+# are tools from osixia/light-baseimage
+RUN /sbin/add-service-available ssl-helper-gnutls \
+ && /sbin/install-service \
+ && /sbin/clean-container
+
+# /sbin/add-service-available ssl-helper-gnutls
+# Add ssl-helper-gnutls, used to generate TLS default certificates
+
+# /sbin/install-service
+# make an apt-get update
+# run /osixia/service/*/install.sh
+# link /osixia/service/*/container-start.sh to /etc/my_init.d/*
+# link /osixia/service/*/daemon.sh to /etc/service/*/run
+
+# Files in /etc/my_init.d will be run during container start,
+# Files in /etc/service/*/run are the process run by the docker image
+
+# /sbin/clean-container remove unnecessary files
+
+# More information :
+# https://github.com/osixia/docker-light-baseimage
+
 
 # Add default env variables
 ADD env.yaml /etc/env.yaml

+ 2 - 5
image/service/slapd/container-start.sh

@@ -109,11 +109,8 @@ EOF
   # set bootstrap config part 2
   if $BOOTSTRAP; then
 
-    # add ppolicy schema if not already exists
-    ADD_PPOLICY=$(is_new_schema ppolicy)
-    if [ "$ADD_PPOLICY" -eq 1 ]; then
-      ldapadd -c -Y EXTERNAL -Q -H ldapi:/// -f /etc/ldap/schema/ppolicy.ldif
-    fi
+    # add ppolicy schema
+    ldapadd -c -Y EXTERNAL -Q -H ldapi:/// -f /etc/ldap/schema/ppolicy.ldif
 
     # convert schemas to ldif
     SCHEMAS=""

+ 11 - 0
image/service/slapd/install.sh

@@ -0,0 +1,11 @@
+#!/bin/bash -e
+
+# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
+RUN groupadd -r openldap && useradd -r -g openldap openldap
+
+# Install OpenLDAP, ldap-utils
+LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends \
+slapd ldap-utils
+
+# Remove default ldap db
+rm -rf /var/lib/ldap /etc/ldap/slapd.d

+ 1 - 1
test/test.bats

@@ -65,7 +65,7 @@ load test_helper
   LDAP_REPL_CID=$(docker run -h ldap2.example.org -e USE_REPLICATION=true -e IS_REPLICATION_TEST=true -d $NAME:$VERSION)
   LDAP_REPL_IP=$(get_container_ip_by_cid $LDAP_REPL_CID)
 
-  sleep 2
+  sleep 1
 
   # ldap server
   run_image -h ldap.example.org -e USE_REPLICATION=true -e IS_REPLICATION_TEST=true