-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aling Docker image with official GN image
- Loading branch information
1 parent
ad16a5f
commit 6b2ccb1
Showing
7 changed files
with
90 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,51 @@ | ||
FROM jetty:9-jdk8-eclipse-temurin as build | ||
FROM maven:3-eclipse-temurin-8 AS build | ||
|
||
ARG COMMIT_OR_BRANCH=eea-4.2.0 | ||
|
||
USER root | ||
RUN apt-get -y update && \ | ||
apt-get install -y maven \ | ||
git \ | ||
zip | ||
apt-get install -y --no-install-recommends \ | ||
unzip | ||
|
||
|
||
RUN git clone --recursive https://github.com/eea/geonetwork-eea.git /tmp/geonetwork-eea | ||
WORKDIR /tmp/geonetwork-eea | ||
RUN git checkout $COMMIT_OR_BRANCH | ||
RUN git submodule update --init --recursive | ||
RUN mvn install -DskipTests -Penv-catalogue | ||
RUN unzip /tmp/geonetwork-eea/web/target/catalogue.war -d /tmp/geonetwork | ||
|
||
USER jetty | ||
RUN git clone --recursive https://github.com/eea/geonetwork-eea.git | ||
|
||
RUN cd geonetwork-eea && \ | ||
mvn clean install -DskipTests | ||
RUN cd geonetwork-eea/web && \ | ||
mvn package -DskipTests -Penv-catalogue | ||
FROM jetty:9-jdk8-eclipse-temurin AS final | ||
LABEL maintainer="michimau <[email protected]>" | ||
|
||
RUN unzip /var/lib/jetty/geonetwork-eea/web/target/catalogue.war -d /var/lib/jetty/webapps/catalogue | ||
ENV DATA_DIR /catalogue-data | ||
ENV WEBAPP_CONTEXT_PATH /geonetwork | ||
ENV GN_CONFIG_PROPERTIES -Dgeonetwork.dir=${DATA_DIR} \ | ||
-Dgeonetwork.formatter.dir=${DATA_DIR}/data/formatter \ | ||
-Dgeonetwork.schema.dir=/opt/geonetwork/WEB-INF/data/config/schema_plugins \ | ||
-Dgeonetwork.indexConfig.dir=/opt/geonetwork/WEB-INF/data/config/index | ||
|
||
|
||
FROM jetty:9-jdk8-eclipse-temurin | ||
MAINTAINER michimau <[email protected]> | ||
ENV JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true \ | ||
-Xms512M -Xss512M -Xmx2G -XX:+UseConcMarkSweepGC | ||
|
||
|
||
USER root | ||
|
||
RUN rm -rf /var/lib/jetty/webapps/* && \ | ||
chown jetty:jetty /var/lib/jetty/webapps && \ | ||
mkdir -p /catalogue-data && \ | ||
chown -R jetty:jetty /catalogue-data | ||
|
||
COPY --from=build /var/lib/jetty/webapps/catalogue /var/lib/jetty/webapps/catalogue | ||
|
||
COPY docker-entrypoint.sh / | ||
mkdir -p ${DATA_DIR} && \ | ||
chown -R jetty:jetty ${DATA_DIR} | ||
|
||
USER jetty | ||
COPY jetty/geonetwork_context_template.xml /usr/local/share/geonetwork/geonetwork_context_template.xml | ||
RUN java -jar /usr/local/jetty/start.jar --create-startd --add-module=http-forwarded | ||
COPY docker-entrypoint.sh /geonetwork-entrypoint.sh | ||
|
||
COPY --chown=jetty:jetty --from=build /tmp/geonetwork /opt/geonetwork | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
ENTRYPOINT ["/geonetwork-entrypoint.sh"] | ||
CMD ["java","-jar","/usr/local/jetty/start.jar"] | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
#!/bin/bash | ||
|
||
docker build -t eeacms/geonetwork-eea:$(git ls-remote https://github.com/eea/geonetwork-eea.git HEAD | cut -f1) . | ||
GIT_COMMIT=$(git ls-remote https://github.com/eea/geonetwork-eea.git HEAD | cut -f1) | ||
echo "Building https://github.com/eea/geonetwork-eea.git at $GIT_COMMIT" | ||
docker build \ | ||
-t eeacms/geonetwork-eea:${GIT_COMMIT} \ | ||
--build-arg COMMIT_OR_BRANCH=${GIT_COMMIT} \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,147 +1,24 @@ | ||
#!/bin/sh | ||
|
||
#!/bin/bash | ||
set -e | ||
|
||
mkdir -p /catalogue-data/htmlcache | ||
mkdir -p /catalogue-data/lucene | ||
mkdir -p /catalogue-data/logs | ||
|
||
if [ "${ES_HOST}" != "localhost" ]; then | ||
sed -i "s#http://localhost:9200#${ES_PROTOCOL:="http"}://${ES_HOST}:${ES_PORT:="9200"}#g" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/web.xml" ; | ||
sed -i "s#es.host=localhost#es.host=${ES_HOST}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
fi; | ||
|
||
if [ -n "${ES_PROTOCOL}" ] && [ "${ES_PROTOCOL}" != "http" ] ; then | ||
sed -i "s#es.protocol=http#es.protocol=${ES_PROTOCOL}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
fi | ||
|
||
if [ -n "${ES_PORT}" ] && [ "$ES_PORT" != "9200" ] ; then | ||
sed -i "s#es.port=9200#es.port=${ES_PORT}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
fi | ||
|
||
if [ -n "${ES_INDEX_RECORDS}" ] && [ "$ES_INDEX_RECORDS" != "gn-records" ] ; then | ||
sed -i "s#es.index.records=gn-records#es.index.records=${ES_INDEX_RECORDS}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
fi | ||
|
||
if [ "${ES_USERNAME}" != "" ] ; then | ||
sed -i "s#es.username=#es.username=${ES_USERNAME}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
fi | ||
|
||
if [ "${ES_PASSWORD}" != "" ] ; then | ||
sed -i "s#es.password=#es.password=${ES_PASSWORD}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
fi | ||
|
||
if [ -n "${KB_URL}" ] && [ "$KB_URL" != "http://localhost:5601" ]; then | ||
sed -i "s#kb.url=http://localhost:5601#kb.url=${KB_URL}#" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/config.properties" ; | ||
sed -i "s#http://localhost:5601#${KB_URL}#g" "${JETTY_BASE}/webapps/$CATALOGUE/WEB-INF/web.xml" ; | ||
fi | ||
|
||
if [ "$1" = jetty.sh ]; then | ||
if ! command -v bash >/dev/null 2>&1 ; then | ||
cat >&2 <<- 'EOWARN' | ||
******************************************************************** | ||
ERROR: bash not found. Use of jetty.sh requires bash. | ||
******************************************************************** | ||
EOWARN | ||
exit 1 | ||
fi | ||
cat >&2 <<- 'EOWARN' | ||
******************************************************************** | ||
WARNING: Use of jetty.sh from this image is deprecated and may | ||
be removed at some point in the future. | ||
export JAVA_OPTIONS="${JAVA_OPTS} ${GN_CONFIG_PROPERTIES}" | ||
|
||
See the documentation for guidance on extending this image: | ||
https://github.com/docker-library/docs/tree/master/jetty | ||
******************************************************************** | ||
EOWARN | ||
fi | ||
GN_BASE_DIR=/opt/geonetwork | ||
|
||
if ! command -v -- "$1" >/dev/null 2>&1 ; then | ||
set -- java -jar "$JETTY_HOME/start.jar" "$@" | ||
fi | ||
|
||
: ${TMPDIR:=/tmp/jetty} | ||
[ -d "$TMPDIR" ] || mkdir -p $TMPDIR 2>/dev/null | ||
|
||
: ${JETTY_START:=$JETTY_BASE/jetty.start} | ||
|
||
case "$JAVA_OPTIONS" in | ||
*-Djava.io.tmpdir=*) ;; | ||
*) JAVA_OPTIONS="-Djava.io.tmpdir=$TMPDIR $JAVA_OPTIONS" ;; | ||
esac | ||
if [[ "$1" = jetty.sh ]] || [[ $(expr "$*" : 'java .*/start\.jar.*$') != 0 ]]; then | ||
# Customize context path | ||
if [ ! -f "${JETTY_BASE}/webapps/geonetwork.xml" ]; then | ||
echo "Using ${WEBAPP_CONTEXT_PATH} for deploying the application" | ||
cp /usr/local/share/geonetwork/geonetwork_context_template.xml "${JETTY_BASE}/webapps/geonetwork.xml" | ||
sed -i "s#GEONETWORK_CONTEXT_PATH#${WEBAPP_CONTEXT_PATH}#" "${JETTY_BASE}/webapps/geonetwork.xml" | ||
fi | ||
|
||
if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then | ||
# this is a command to run jetty | ||
|
||
# check if it is a terminating command | ||
for A in "$@" ; do | ||
case $A in | ||
--add-to-start* |\ | ||
--create-files |\ | ||
--create-startd |\ | ||
--download |\ | ||
--dry-run |\ | ||
--exec-print |\ | ||
--help |\ | ||
--info |\ | ||
--list-all-modules |\ | ||
--list-classpath |\ | ||
--list-config |\ | ||
--list-modules* |\ | ||
--stop |\ | ||
--update-ini |\ | ||
--version |\ | ||
-v )\ | ||
# It is a terminating command, so exec directly | ||
JAVA="$1" | ||
shift | ||
exec $JAVA $JAVA_OPTIONS "$@" | ||
esac | ||
done | ||
|
||
if [ $(whoami) != "jetty" ]; then | ||
cat >&2 <<- EOWARN | ||
******************************************************************** | ||
WARNING: User is $(whoami) | ||
The user should be (re)set to 'jetty' in the Dockerfile | ||
******************************************************************** | ||
EOWARN | ||
fi | ||
|
||
if [ -f $JETTY_START ] ; then | ||
if [ $JETTY_BASE/start.d -nt $JETTY_START ] ; then | ||
cat >&2 <<- EOWARN | ||
******************************************************************** | ||
WARNING: The $JETTY_BASE/start.d directory has been modified since | ||
the $JETTY_START files was generated. Either delete | ||
the $JETTY_START file or re-run | ||
/generate-jetty.start.sh | ||
from a Dockerfile | ||
******************************************************************** | ||
EOWARN | ||
fi | ||
echo $(date +'%Y-%m-%d %H:%M:%S.000'):INFO:docker-entrypoint:jetty start from $JETTY_START | ||
set -- $(cat $JETTY_START) | ||
else | ||
# Do a jetty dry run to set the final command | ||
JAVA="$1" | ||
shift | ||
$JAVA $JAVA_OPTIONS "$@" --dry-run > $JETTY_START | ||
if [ $(egrep -v '\\$' $JETTY_START | wc -l ) -gt 1 ] ; then | ||
# command was more than a dry-run | ||
cat $JETTY_START \ | ||
| awk '/\\$/ { printf "%s", substr($0, 1, length($0)-1); next } 1' \ | ||
| egrep -v '[^ ]*java .* org\.eclipse\.jetty\.xml\.XmlConfiguration ' | ||
exit | ||
fi | ||
set -- $(sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' $JETTY_START) | ||
fi | ||
# Delegate on base image entrypoint to start jetty | ||
exec /docker-entrypoint.sh "$@" | ||
else | ||
exec "$@" | ||
fi | ||
|
||
if [ "${1##*/}" = java -a -n "$JAVA_OPTIONS" ] ; then | ||
JAVA="$1" | ||
shift | ||
set -- "$JAVA" $JAVA_OPTIONS "$@" | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"> | ||
|
||
<Configure class="org.eclipse.jetty.webapp.WebAppContext"> | ||
<Set name="contextPath">GEONETWORK_CONTEXT_PATH</Set> | ||
<Set name="war">/opt/geonetwork</Set> | ||
<Get name="systemClasspathPattern"> | ||
<Call name="add"><Arg>-javax.mail.</Arg></Call> | ||
</Get> | ||
<Get name="serverClasspathPattern"> | ||
<Call name="add"><Arg>javax.mail.</Arg></Call> | ||
</Get> | ||
<Call name="setAttribute"> | ||
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg> | ||
<Arg>nomatches</Arg> | ||
</Call> | ||
</Configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters