diff --git a/Dockerfile b/Dockerfile index 50afc8c..e1a9e58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ -FROM ubuntu:16.04 +FROM --platform=linux/amd64 ubuntu:20.04 MAINTAINER ome-devel@lists.openmicroscopy.org.uk ############################################# # ApacheDS installation ############################################# -ENV APACHEDS_VERSION 2.0.0.AM26 +ENV APACHEDS_VERSION 2.0.0.AM27 +ENV APACHEDS_SNAPSHOT 2.0.0.AM28-SNAPSHOT ENV APACHEDS_ARCH amd64 ENV APACHEDS_ARCHIVE apacheds-${APACHEDS_VERSION}-${APACHEDS_ARCH}.deb @@ -23,12 +24,14 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \ && apt-get install -y \ + ca-certificates \ ldap-utils \ procps \ openjdk-8-jre-headless \ curl \ - jq \ - && curl https://downloads.apache.org/directory/apacheds/dist/${APACHEDS_VERSION}/${APACHEDS_ARCHIVE} > ${APACHEDS_ARCHIVE} \ + jq + +RUN curl https://dlcdn.apache.org//directory/apacheds/dist/2.0.0.AM27/apacheds-2.0.0.AM27-amd64.deb > ${APACHEDS_ARCHIVE} \ && dpkg -i ${APACHEDS_ARCHIVE} \ && rm ${APACHEDS_ARCHIVE} @@ -61,7 +64,9 @@ RUN mkdir ${APACHEDS_BOOTSTRAP}/cache \ && mkdir ${APACHEDS_BOOTSTRAP}/partitions \ && chown -R ${APACHEDS_USER}:${APACHEDS_GROUP} ${APACHEDS_BOOTSTRAP} -RUN apt-get install -y python-ldap +RUN apt-get install -y pip +RUN apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev +RUN pip install python-ldap ADD bin/ldapmanager /usr/local/bin/ldapmanager ############################################# @@ -69,7 +74,7 @@ ADD bin/ldapmanager /usr/local/bin/ldapmanager ############################################# # Correct for hard-coded INSTANCES_DIRECTORY variable -RUN sed -i "s#/var/lib/apacheds-${APACHEDS_VERSION}#/var/lib/apacheds#" /opt/apacheds-${APACHEDS_VERSION}/bin/apacheds +RUN sed -i "s#/var/lib/apacheds-${APACHEDS_VERSION}#/var/lib/apacheds#" /opt/apacheds-${APACHEDS_SNAPSHOT}/bin/apacheds RUN curl -L -o /usr/local/bin/dumb-init \ diff --git a/README.md b/README.md index beb0212..41eff00 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,24 @@ The project sources can be found on [GitHub](https://github.com/openmicroscopy/a ## Build git clone https://github.com/openmicroscopy/apacheds-docker.git - docker build -t openmicroscopy/apacheds:2.0.0.AM26 apacheds-docker + docker build -t openmicroscopy/apacheds:2.0.0.AM27 apacheds-docker ## Installation The folder */var/lib/apacheds* contains the runtime data and thus has been defined as a volume. The image uses exactly the file system structure defined by the [ApacheDS documentation](https://directory.apache.org/apacheds/advanced-ug/2.2.1-debian-instance-layout.html). -The container can be started issuing the following command: +### Run by Local Image - docker run --name ldap -d -p 389:10389 openmicroscopy/apacheds +Create and run a container using the image that was built in the previous steps: + + docker run --name ldap --platform linux/amd64 -dit -p 389:10389 openmicroscopy/apacheds:2.0.0.AM27 + +### Run by Remote Image + +Alternatively, you can create and run a container using a pre-built remote image: + + docker run --name ldap --platform linux/amd64 -d -p 389:10389 openmicroscopy/apacheds ## Usage diff --git a/scripts/run.sh b/scripts/run.sh index d3cd204..9a3be81 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -8,8 +8,8 @@ # APACHEDS_USER # APACHEDS_GROUP -APACHEDS_INSTANCE_DIRECTORY=${APACHEDS_DATA}/${APACHEDS_INSTANCE} -PIDFILE="${APACHEDS_INSTANCE_DIRECTORY}/run/apacheds-${APACHEDS_INSTANCE}.pid" +export APACHEDS_INSTANCE_DIRECTORY=${APACHEDS_DATA}-${APACHEDS_SNAPSHOT} +export PIDFILE="${APACHEDS_INSTANCE_DIRECTORY}/default/run/apacheds-${APACHEDS_INSTANCE}.pid" # When a fresh data folder is detected then bootstrap the instance configuration. if [ ! -d ${APACHEDS_INSTANCE_DIRECTORY} ]; then @@ -29,13 +29,13 @@ cleanup(){ trap cleanup EXIT cleanup -/opt/apacheds-${APACHEDS_VERSION}/bin/apacheds start ${APACHEDS_INSTANCE} +/opt/apacheds-${APACHEDS_SNAPSHOT}/bin/apacheds start ${APACHEDS_INSTANCE} sleep 2 # Wait on new pid shutdown(){ echo "Shutting down..." - /opt/apacheds-${APACHEDS_VERSION}/bin/apacheds stop ${APACHEDS_INSTANCE} + /opt/apacheds-${APACHEDS_SNAPSHOT}/bin/apacheds stop ${APACHEDS_INSTANCE} } trap shutdown INT TERM -tail -n 0 --pid=$(cat $PIDFILE) -f ${APACHEDS_INSTANCE_DIRECTORY}/log/apacheds.log +tail -n 0 --pid=$(cat $PIDFILE) -f ${APACHEDS_INSTANCE_DIRECTORY}/default/log/apacheds.log