- Added geonetwork library#2113
Conversation
|
Apologies for the delay! 😞 My first question would be whether you've been in contact with GeoNetwork upstream to see if they're either interested in being involved, maintaining the image, providing their blessing for your ownership/maintainership of it, or would even rather there weren't an official image for GeoNetwork at all (which has happened before)? 🙏 😅 |
|
Thanks for getting in touch @tianon . No one in the upstream geonetwork opposed to having this image, and actually two of the members are in GeoCat, so we are happy to maintain this image along with the software. I have now moved the docker code to the geonetwork official repository, to make it a bit more "official". |
|
Thanks @doublebyte1; that's excellent! ❤️ ❤️ Looking through the Dockerization at a rough glance, I've got the following notes so far:
I'm happy to send a PR for any/all of this if that'd make it easier to understand/discuss or if that'd help get it implemented. 👍 |
|
I've created a PR over in geonetwork/docker-geonetwork#1 with some further suggestions (I figured a PR would be easier to discuss around). 👍 |
|
@tianon : I have just merged your commit 👍 |
|
Sorry for the slow reply. 😞 Looked at master branch and it all seems fine to me. I think we just need the On a side note, you may want to combine the |
library/geonetwork
Outdated
| GitCommit: 35a1391f8bd9c8d607cc9ac9fc1fa753160df79c | ||
| Directory: 3.0.4/postgres | ||
|
|
||
| Tags: 3.0.5, 3, latest |
There was a problem hiding this comment.
One other note, did you also want a 3.0 version here to follow the latest 3.0 series, like the 3.2 below?
There was a problem hiding this comment.
Related to your other comment, I've been reviewing the geonetwork versions and discussing with the other developers and we think it makes more sense to keep just two versions; the tip of the branch 3.0.x and the tip of the branch 3.2.x (tagged as latest). This is reflected on the latest version of the library file.
diff --git a/geonetwork_3.0-postgres/Dockerfile b/geonetwork_3.0-postgres/Dockerfile
new file mode 100644
index 0000000..10580fd
--- /dev/null
+++ b/geonetwork_3.0-postgres/Dockerfile
@@ -0,0 +1,16 @@
+FROM geonetwork:3.0.5
+
+RUN apt-get update && apt-get install -y postgresql-client && \
+ rm -rf /var/lib/apt/lists/*
+
+#Set PostgreSQL as default GN DB
+RUN sed -i -e 's#<import resource="../config-db/h2.xml"/>#<!--<import resource="../config-db/h2.xml"/> -->#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-node/srv.xml && \
+sed -i -e 's#<!--<import resource="../config-db/postgres.xml"/>-->#<import resource="../config-db/postgres.xml"/>#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-node/srv.xml
+
+COPY ./jdbc.properties $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+
+#Initializing database & connection string for GN
+COPY ./docker-entrypoint.sh /entrypoint.sh
+ENTRYPOINT ["/entrypoint.sh"]
+
+CMD ["catalina.sh", "run"]
diff --git a/geonetwork_3.0-postgres/docker-entrypoint.sh b/geonetwork_3.0-postgres/docker-entrypoint.sh
new file mode 100755
index 0000000..8aba177
--- /dev/null
+++ b/geonetwork_3.0-postgres/docker-entrypoint.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+set -e
+
+if [ "$1" = 'catalina.sh' ]; then
+
+ mkdir -p "$DATA_DIR"
+
+ #Set geonetwork data dir
+ export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.dir=$DATA_DIR"
+
+ #Setting host (use $POSTGRES_DB_HOST if it's set, otherwise use "postgres")
+ db_host="${POSTGRES_DB_HOST:-postgres}"
+ echo "db host: $db_host"
+
+ #Setting port
+ db_port="${POSTGRES_DB_PORT:-5432}"
+ echo "db port: $db_port"
+
+ if [ -z "$POSTGRES_DB_USERNAME" ] || [ -z "$POSTGRES_DB_PASSWORD" ]; then
+ echo >&2 "you must set POSTGRES_DB_USERNAME and POSTGRES_DB_PASSWORD"
+ exit 1
+ fi
+
+ db_admin="admin"
+ db_gn="geonetwork"
+
+ #Create databases, if they do not exist yet (http://stackoverflow.com/a/36591842/433558)
+ echo "$db_host:$db_port:*:$POSTGRES_DB_USERNAME:$POSTGRES_DB_PASSWORD" > ~/.pgpass
+ chmod 0600 ~/.pgpass
+ for db_name in "$db_admin" "$db_gn"; do
+ if psql -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -tqc "SELECT 1 FROM pg_database WHERE datname = '$db_name'" | grep -q 1; then
+ echo "database '$db_name' exists; skipping createdb"
+ else
+ createdb -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -O "$POSTGRES_DB_USERNAME" "$db_name"
+ fi
+ done
+ rm ~/.pgpass
+
+ #Write connection string for GN
+ sed -ri '/^jdbc[.](username|password|database|host|port)=/d' "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.username=$POSTGRES_DB_USERNAME" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.password=$POSTGRES_DB_PASSWORD" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.database=$db_gn" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.host=$db_host" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.port=$db_port" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+
+ #Fixing an hardcoded port on the connection string (bug fixed on development branch)
+ sed -i -e 's#5432#${jdbc.port}#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-db/postgres.xml
+fi
+
+exec "$@"
diff --git a/geonetwork_3.0-postgres/jdbc.properties b/geonetwork_3.0-postgres/jdbc.properties
new file mode 100644
index 0000000..00a8ba1
--- /dev/null
+++ b/geonetwork_3.0-postgres/jdbc.properties
@@ -0,0 +1,17 @@
+jdbc.basic.removeAbandoned=true
+jdbc.basic.removeAbandonedTimeout=120
+jdbc.basic.logAbandoned=true
+jdbc.basic.maxActive=33
+jdbc.basic.maxIdle=${jdbc.basic.maxActive}
+jdbc.basic.initialSize=${jdbc.basic.maxActive}
+jdbc.basic.maxWait=200
+jdbc.basic.testOnBorrow=true
+jdbc.basic.timeBetweenEvictionRunsMillis=10000
+jdbc.basic.minEvictableIdleTimeMillis=1800000
+jdbc.basic.testWhileIdle=true
+jdbc.basic.numTestsPerEvictionRun=3
+jdbc.basic.poolPreparedStatements=true
+jdbc.basic.maxOpenPreparedStatements=1200
+jdbc.basic.validationQuery=SELECT 1
+jdbc.basic.defaultReadOnly=false
+jdbc.basic.defaultAutoCommit=false
diff --git a/geonetwork_3.0/Dockerfile b/geonetwork_3.0/Dockerfile
new file mode 100644
index 0000000..46b9fda
--- /dev/null
+++ b/geonetwork_3.0/Dockerfile
@@ -0,0 +1,24 @@
+FROM tomcat:8.0-jre7
+
+ENV GN_FILE geonetwork.war
+ENV DATA_DIR=$CATALINA_HOME/webapps/geonetwork/WEB-INF/data
+ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512M -Xss2M -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC"
+
+#Environment variables
+ENV GN_VERSION 3.0.5
+ENV GN_DOWNLOAD_MD5 1e77c39de4ad156cc9b3c2b033cab359
+
+WORKDIR $CATALINA_HOME/webapps
+
+RUN curl -fSL -o $GN_FILE \
+ https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${GN_VERSION}/geonetwork.war/download && \
+ echo "$GN_DOWNLOAD_MD5 *$GN_FILE" | md5sum -c && \
+ mkdir -p geonetwork && \
+ unzip -e $GN_FILE -d geonetwork && \
+ rm $GN_FILE
+
+#Set geonetwork data dir
+COPY ./docker-entrypoint.sh /entrypoint.sh
+ENTRYPOINT ["/entrypoint.sh"]
+
+CMD ["catalina.sh", "run"]
diff --git a/geonetwork_3.0/docker-entrypoint.sh b/geonetwork_3.0/docker-entrypoint.sh
new file mode 100755
index 0000000..39f5ba6
--- /dev/null
+++ b/geonetwork_3.0/docker-entrypoint.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+if [ "$1" = 'catalina.sh' ]; then
+
+ mkdir -p "$DATA_DIR"
+
+ #Set geonetwork data dir
+ export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.dir=$DATA_DIR"
+fi
+
+exec "$@"
diff --git a/geonetwork_latest/Dockerfile b/geonetwork_latest/Dockerfile
new file mode 100644
index 0000000..3a94850
--- /dev/null
+++ b/geonetwork_latest/Dockerfile
@@ -0,0 +1,24 @@
+FROM tomcat:8.0-jre8
+
+ENV GN_FILE geonetwork.war
+ENV DATA_DIR=$CATALINA_HOME/webapps/geonetwork/WEB-INF/data
+ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512M -Xss2M -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC"
+
+#Environment variables
+ENV GN_VERSION 3.2.0
+ENV GN_DOWNLOAD_MD5 87a84ffb3fbbd662d595c08e1a7fdff2
+
+WORKDIR $CATALINA_HOME/webapps
+
+RUN curl -fSL -o $GN_FILE \
+ https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${GN_VERSION}/geonetwork.war/download && \
+ echo "$GN_DOWNLOAD_MD5 *$GN_FILE" | md5sum -c && \
+ mkdir -p geonetwork && \
+ unzip -e $GN_FILE -d geonetwork && \
+ rm $GN_FILE
+
+#Set geonetwork data dir
+COPY ./docker-entrypoint.sh /entrypoint.sh
+ENTRYPOINT ["/entrypoint.sh"]
+
+CMD ["catalina.sh", "run"]
diff --git a/geonetwork_latest/docker-entrypoint.sh b/geonetwork_latest/docker-entrypoint.sh
new file mode 100755
index 0000000..39f5ba6
--- /dev/null
+++ b/geonetwork_latest/docker-entrypoint.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+if [ "$1" = 'catalina.sh' ]; then
+
+ mkdir -p "$DATA_DIR"
+
+ #Set geonetwork data dir
+ export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.dir=$DATA_DIR"
+fi
+
+exec "$@"
diff --git a/geonetwork_postgres/Dockerfile b/geonetwork_postgres/Dockerfile
new file mode 100644
index 0000000..f756469
--- /dev/null
+++ b/geonetwork_postgres/Dockerfile
@@ -0,0 +1,16 @@
+FROM geonetwork:3.2.0
+
+RUN apt-get update && apt-get install -y postgresql-client && \
+ rm -rf /var/lib/apt/lists/*
+
+#Set PostgreSQL as default GN DB
+RUN sed -i -e 's#<import resource="../config-db/h2.xml"/>#<!--<import resource="../config-db/h2.xml"/> -->#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-node/srv.xml && \
+sed -i -e 's#<!--<import resource="../config-db/postgres.xml"/>-->#<import resource="../config-db/postgres.xml"/>#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-node/srv.xml
+
+COPY ./jdbc.properties $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+
+#Initializing database & connection string for GN
+COPY ./docker-entrypoint.sh /entrypoint.sh
+ENTRYPOINT ["/entrypoint.sh"]
+
+CMD ["catalina.sh", "run"]
diff --git a/geonetwork_postgres/docker-entrypoint.sh b/geonetwork_postgres/docker-entrypoint.sh
new file mode 100755
index 0000000..8aba177
--- /dev/null
+++ b/geonetwork_postgres/docker-entrypoint.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+set -e
+
+if [ "$1" = 'catalina.sh' ]; then
+
+ mkdir -p "$DATA_DIR"
+
+ #Set geonetwork data dir
+ export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.dir=$DATA_DIR"
+
+ #Setting host (use $POSTGRES_DB_HOST if it's set, otherwise use "postgres")
+ db_host="${POSTGRES_DB_HOST:-postgres}"
+ echo "db host: $db_host"
+
+ #Setting port
+ db_port="${POSTGRES_DB_PORT:-5432}"
+ echo "db port: $db_port"
+
+ if [ -z "$POSTGRES_DB_USERNAME" ] || [ -z "$POSTGRES_DB_PASSWORD" ]; then
+ echo >&2 "you must set POSTGRES_DB_USERNAME and POSTGRES_DB_PASSWORD"
+ exit 1
+ fi
+
+ db_admin="admin"
+ db_gn="geonetwork"
+
+ #Create databases, if they do not exist yet (http://stackoverflow.com/a/36591842/433558)
+ echo "$db_host:$db_port:*:$POSTGRES_DB_USERNAME:$POSTGRES_DB_PASSWORD" > ~/.pgpass
+ chmod 0600 ~/.pgpass
+ for db_name in "$db_admin" "$db_gn"; do
+ if psql -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -tqc "SELECT 1 FROM pg_database WHERE datname = '$db_name'" | grep -q 1; then
+ echo "database '$db_name' exists; skipping createdb"
+ else
+ createdb -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -O "$POSTGRES_DB_USERNAME" "$db_name"
+ fi
+ done
+ rm ~/.pgpass
+
+ #Write connection string for GN
+ sed -ri '/^jdbc[.](username|password|database|host|port)=/d' "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.username=$POSTGRES_DB_USERNAME" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.password=$POSTGRES_DB_PASSWORD" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.database=$db_gn" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.host=$db_host" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+ echo "jdbc.port=$db_port" >> "$CATALINA_HOME"/webapps/geonetwork/WEB-INF/config-db/jdbc.properties
+
+ #Fixing an hardcoded port on the connection string (bug fixed on development branch)
+ sed -i -e 's#5432#${jdbc.port}#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-db/postgres.xml
+fi
+
+exec "$@"
diff --git a/geonetwork_postgres/jdbc.properties b/geonetwork_postgres/jdbc.properties
new file mode 100644
index 0000000..00a8ba1
--- /dev/null
+++ b/geonetwork_postgres/jdbc.properties
@@ -0,0 +1,17 @@
+jdbc.basic.removeAbandoned=true
+jdbc.basic.removeAbandonedTimeout=120
+jdbc.basic.logAbandoned=true
+jdbc.basic.maxActive=33
+jdbc.basic.maxIdle=${jdbc.basic.maxActive}
+jdbc.basic.initialSize=${jdbc.basic.maxActive}
+jdbc.basic.maxWait=200
+jdbc.basic.testOnBorrow=true
+jdbc.basic.timeBetweenEvictionRunsMillis=10000
+jdbc.basic.minEvictableIdleTimeMillis=1800000
+jdbc.basic.testWhileIdle=true
+jdbc.basic.numTestsPerEvictionRun=3
+jdbc.basic.poolPreparedStatements=true
+jdbc.basic.maxOpenPreparedStatements=1200
+jdbc.basic.validationQuery=SELECT 1
+jdbc.basic.defaultReadOnly=false
+jdbc.basic.defaultAutoCommit=false |
|
Build test of #2113; 96b9ccb ( $ bashbrew build geonetwork:3.0.5
Building bashbrew/cache:19622ec90779de2fa26d56b2e13ea9e6939dd45a630c1da424f26f72953fb78f (geonetwork:3.0.5)
Tagging geonetwork:3.0.5
Tagging geonetwork:3.0
$ test/run.sh geonetwork:3.0.5
testing geonetwork:3.0.5
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
$ bashbrew build geonetwork:3.0.5-postgres
Building bashbrew/cache:9bf90ac0f6f1f5bf57d88bfe01191ecb52c9c5f07faf6ba9c65e7b7038970832 (geonetwork:3.0.5-postgres)
Tagging geonetwork:3.0.5-postgres
Tagging geonetwork:3.0-postgres
$ test/run.sh geonetwork:3.0.5-postgres
testing geonetwork:3.0.5-postgres
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
$ bashbrew build geonetwork:3.2.0
Building bashbrew/cache:8361b49022dc84758c8a86a9ab1f510834c800d671d142c9bcdbd90f7ede4af2 (geonetwork:3.2.0)
Tagging geonetwork:3.2.0
Tagging geonetwork:3.2
Tagging geonetwork:latest
$ test/run.sh geonetwork:3.2.0
testing geonetwork:3.2.0
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
$ bashbrew build geonetwork:3.2.0-postgres
Building bashbrew/cache:0393c9c03e5efcd14be023ec229d5dc11c436ec878e6e7ed8020ff4b0db5af3a (geonetwork:3.2.0-postgres)
Tagging geonetwork:3.2.0-postgres
Tagging geonetwork:3.2-postgres
Tagging geonetwork:postgres
$ test/run.sh geonetwork:3.2.0-postgres
testing geonetwork:3.2.0-postgres
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...passed
|
|
If you are talking about the icon that shows up when searching on the Docker Hub, we unfortunately have no control over them. Ping @toli, can you look into the Docker Hub icons for the Geonetwork repo? (Should I be pinging anyone else here?) Thanks! |
|
@doublebyte1 - the logos are handled in the Hub UI itself. |
|
Filed an internal issue, will try to get it through but no promises on timing. |
Adding library file for geonetwork, the catalog service for geospatial information.
The default image ships with an H2 database backend, and a variant is included which supports connecting to a postgresql instance.
This image also supports setting a custom data directory, which is recommended for production environments.
We will support all major and minor versions, from the latest branch.
Checklist for Review
NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)
foobarneeds Node.js, hasFROM node:...instead of grabbingnodevia other means been considered?)FROM tomcatifFROM scratch, tarballs only exist in a single commit within the associated history?