mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
14.58.2025 832a96f1f4660c10d3e5abffa14269d8c7f4fcb0
Fix docker env variables + add VERSION autodetect (#493)

3 files modified
82 ■■■■■ changed files
opendj-packages/opendj-docker/Dockerfile 36 ●●●●● patch | view | raw | blame | history
opendj-packages/opendj-docker/Dockerfile-alpine 36 ●●●●● patch | view | raw | blame | history
opendj-packages/opendj-docker/README.md 10 ●●●●● patch | view | raw | blame | history
opendj-packages/opendj-docker/Dockerfile
@@ -1,27 +1,31 @@
FROM eclipse-temurin:21-jre-jammy
MAINTAINER Open Identity Platform Community <open-identity-platform-opendj@googlegroups.com>
LABEL org.opencontainers.image.authors="Open Identity Platform Community"
ENV ADD_BASE_ENTRY="--addBaseEntry" \
    PORT=1389 \
    LDAPS_PORT=1636 \
    ADMIN_PORT=4444 \
    BASE_DN=${BASE_DN:-"dc=example,dc=com"} \
    ROOT_USER_DN=${ROOT_USER_DN:-"cn=Directory Manager"} \
    ROOT_PASSWORD=${ROOT_PASSWORD:-"password"} \
    SECRET_VOLUME=${SECRET_VOLUME} \
    OPENDJ_SSL_OPTIONS=${SSL_OPTIONS:-"--generateSelfSignedCertificate"} \
    MASTER_SERVER=${MASTER_SERVER} \
    OPENDJ_REPLICATION_TYPE=${OPENDJ_REPLICATION_TYPE} \
    OPENDJ_USER="opendj" \
    OPENDJ_JAVA_ARGS="-server -XX:+UseContainerSupport"
ENV ADD_BASE_ENTRY="--addBaseEntry"
ENV PORT=1389
ENV LDAPS_PORT=1636
ENV ADMIN_PORT=4444
ENV BASE_DN="dc=example,dc=com"
ENV ROOT_USER_DN="cn=Directory Manager"
ENV ROOT_PASSWORD="password"
#ENV SECRET_VOLUME
ENV OPENDJ_SSL_OPTIONS="--generateSelfSignedCertificate"
#ENV MASTER_SERVER
#ENV OPENDJ_REPLICATION_TYPE
ENV OPENDJ_USER="opendj"
ENV OPENDJ_JAVA_ARGS="-server"
ENV BACKEND_TYPE="je"
ENV BACKEND_DB_DIRECTORY="db"
#ENV SETUP_ARGS
ARG VERSION=@project_version@
ARG VERSION
WORKDIR /opt
RUN  apt-get update \
 && apt-get install -y --no-install-recommends curl unzip \
 && if [ -z "$VERSION" ] ; then VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenDJ/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)"; fi \
 && curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output opendj-$VERSION.zip \
 && unzip opendj-$VERSION.zip \
 && apt-get remove -y --purge curl unzip \
@@ -38,7 +42,7 @@
RUN chmod +x /opt/opendj/run.sh /opt/opendj/bootstrap/setup.sh /opt/opendj/bootstrap/replicate.sh
EXPOSE $PORT $LDAPS_PORT $ADMIN_PORT
EXPOSE $PORT/tcp $LDAPS_PORT/tcp $ADMIN_PORT/tcp
USER $OPENDJ_USER
opendj-packages/opendj-docker/Dockerfile-alpine
@@ -1,28 +1,32 @@
FROM openjdk:8-jre-alpine
MAINTAINER Open Identity Platform Community <open-identity-platform-opendj@googlegroups.com>
LABEL org.opencontainers.image.authors="Open Identity Platform Community"
ENV ADD_BASE_ENTRY="--addBaseEntry" \
    PORT=1389 \
    LDAPS_PORT=1636 \
    ADMIN_PORT=4444 \
    BASE_DN=${BASE_DN:-"dc=example,dc=com"} \
    ROOT_USER_DN=${ROOT_USER_DN:-"cn=Directory Manager"} \
    ROOT_PASSWORD=${ROOT_PASSWORD:-"password"} \
    SECRET_VOLUME=${SECRET_VOLUME} \
    OPENDJ_SSL_OPTIONS=${SSL_OPTIONS:-"--generateSelfSignedCertificate"} \
    MASTER_SERVER=${MASTER_SERVER} \
    OPENDJ_REPLICATION_TYPE=${OPENDJ_REPLICATION_TYPE} \
    OPENDJ_USER="opendj"\
    OPENDJ_JAVA_ARGS="-server -XX:+UseContainerSupport"
ENV ADD_BASE_ENTRY="--addBaseEntry"
ENV PORT=1389
ENV LDAPS_PORT=1636
ENV ADMIN_PORT=4444
ENV BASE_DN="dc=example,dc=com"
ENV ROOT_USER_DN="cn=Directory Manager"
ENV ROOT_PASSWORD="password"
#ENV SECRET_VOLUME
ENV OPENDJ_SSL_OPTIONS="--generateSelfSignedCertificate"
#ENV MASTER_SERVER
#ENV OPENDJ_REPLICATION_TYPE
ENV OPENDJ_USER="opendj"
ENV OPENDJ_JAVA_ARGS="-server -XX:+UseG1GC -XX:+UseContainerSupport"
ENV BACKEND_TYPE="je"
ENV BACKEND_DB_DIRECTORY="db"
#ENV SETUP_ARGS
ARG VERSION=@project_version@
ARG VERSION
WORKDIR /opt
RUN apk add --update --no-cache --virtual builddeps curl unzip \
 && apk upgrade --update --no-cache \
 && apk add bash \
 && if [ -z "$VERSION" ] ; then VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenDJ/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)"; fi \
 && curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output opendj-$VERSION.zip \
 && unzip opendj-$VERSION.zip \
 && apk del builddeps \
@@ -40,7 +44,7 @@
RUN chmod +x /opt/opendj/run.sh /opt/opendj/bootstrap/setup.sh /opt/opendj/bootstrap/replicate.sh
EXPOSE $PORT $LDAPS_PORT $ADMIN_PORT
EXPOSE $PORT/tcp $LDAPS_PORT/tcp $ADMIN_PORT/tcp
USER $OPENDJ_USER
opendj-packages/opendj-docker/README.md
@@ -3,13 +3,13 @@
Build docker image:
```bash
docker build -t openidentityplatform/opendj --build-arg VERSION=4.5.1 .
docker build -t openidentityplatform/opendj .
```
Run image
```bash
docker run -d -p 1389:1389 -p 1636:1636 -p 4444:4444 --name opendj openidentityplatform/opendj:4.5.1
docker run -d -p 1389:1389 -p 1636:1636 -p 4444:4444 --name opendj openidentityplatform/opendj
```
## Environment Variables
@@ -25,8 +25,10 @@
| SECRET_VOLUME           | -                               | Mounted keystore volume, if present copies keystore over                                                                                                                                                                                                |
| MASTER_SERVER           | -                               | Replication master server                                                                                                                                                                                                                               |
| VERSION                 | -                               | OpenDJ version                                                                                                                                                                                                                                          |
| OPENDJ_USER             | -                               | user which runs OpenDJ                                                                                                                                                                                                                                  |
| OPENDJ_USER             | opendj                          | user which runs OpenDJ                                                                                                                                                                                                                                  |
| OPENDJ_REPLICATION_TYPE | -                               | OpenDJ Replication type, valid values are: <ul><li>simple - standart replication</li><li>srs - standalone replication servers</li><li>sdsr - Standalone Directory Server Replicas</li><li>rg - Replication Groups</li></ul>Other values will be ignored |
| OPENDJ_SSL_OPTIONS      | --generateSelfSignedCertificate | you can replace ssl options at here, like : "--usePkcs12keyStore /opt/domain.pfx --keyStorePassword domain"                                                                                                                                             |
| OPENDJ_JAVA_ARGS        | -server                         | extra instance java args                                                                                                                                                                                                                                |
| BACKEND_TYPE            | je                              | OpenDJ backend type, see [dsconfig create-backend](https://doc.openidentityplatform.org/opendj/reference/dsconfig-subcommands-ref#dsconfig-create-backend) documentation                                                                                |
| BACKEND_DB_DIRECTORY    | db                              | OpenDJ `db-directory` attribute for backend                                                                                                                                                                                                             |
| BACKEND_DB_DIRECTORY    | db                              | OpenDJ `db-directory` attribute for backend                                                                                                                                                                                                             |
| SETUP_ARGS              | -                               | extra setup args                                                                                                                                                                                                                                        |