Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM ubuntu:16.04
FROM --platform=linux/amd64 ubuntu:20.04
MAINTAINER [email protected]

#############################################
# 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
Expand All @@ -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}

Expand Down Expand Up @@ -61,15 +64,17 @@ 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

#############################################
# ApacheDS wrapper command
#############################################

# 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 \
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I see how you are referring here to the above commands but we also want a suggestion on how to run publicly. Maybe duplicate if you think it's worth it.


### 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
Expand Down
10 changes: 5 additions & 5 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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