-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(support-services): use local gn4 image with dcat-ap
- Loading branch information
Showing
4 changed files
with
109 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
FROM alpine/git AS clone | ||
WORKDIR /app | ||
RUN git clone --recursive --depth=1 --shallow-submodules https://github.com/geonetwork/core-geonetwork.git | ||
RUN git clone --recursive --depth=1 --shallow-submodules https://github.com/metadata101/dcat-ap.git | ||
|
||
|
||
FROM maven:3.9-amazoncorretto-11 AS build | ||
|
||
WORKDIR /app | ||
COPY --from=clone /app/core-geonetwork /app | ||
COPY --from=clone /app/dcat-ap /app/schemas/dcat-ap | ||
|
||
# reference DCAT-AP plugin (see https://github.com/metadata101/dcat-ap) | ||
RUN sed -i "s#</modules>#<module>dcat-ap</module></modules>#" \ | ||
/app/schemas/pom.xml | ||
RUN sed -i 's#</dependencies>#<dependency><groupId>org.geonetwork-opensource.schemas</groupId><artifactId>gn-schema-dcat-ap</artifactId><version>${project.version}</version></dependency></dependencies>#' \ | ||
/app/web/pom.xml | ||
RUN sed -i 's#</artifactItems>#<artifactItem><groupId>org.geonetwork-opensource.schemas</groupId><artifactId>gn-schema-dcat-ap</artifactId><type>zip</type><overWrite>false</overWrite><outputDirectory>${schema-plugins.dir}</outputDirectory></artifactItem></artifactItems>#' \ | ||
/app/web/pom.xml | ||
|
||
RUN mvn install -DskipTests | ||
|
||
|
||
FROM jetty:9-jdk11 | ||
|
||
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 | ||
|
||
ENV JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true \ | ||
-Xms512M -Xss512M -Xmx2G -XX:+UseConcMarkSweepGC | ||
|
||
USER root | ||
RUN apt-get -y update && \ | ||
apt-get -y install --no-install-recommends \ | ||
unzip && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
mkdir -p ${DATA_DIR} && \ | ||
chown -R jetty:jetty ${DATA_DIR} && \ | ||
mkdir -p /opt/geonetwork && \ | ||
chown -R jetty:jetty /opt/geonetwork | ||
|
||
USER jetty | ||
|
||
COPY --from=build /app/web/target/geonetwork.war /opt/geonetwork/ | ||
|
||
RUN cd /opt/geonetwork/ && \ | ||
unzip -q geonetwork.war && \ | ||
rm geonetwork.war | ||
|
||
COPY jetty/geonetwork_context_template.xml /usr/local/share/geonetwork/geonetwork_context_template.xml | ||
COPY ./docker-entrypoint.sh /geonetwork-entrypoint.sh | ||
|
||
RUN java -jar /usr/local/jetty/start.jar --create-startd --add-module=http-forwarded | ||
|
||
ENTRYPOINT ["/geonetwork-entrypoint.sh"] | ||
CMD ["java","-jar","/usr/local/jetty/start.jar"] | ||
|
||
VOLUME [ "${DATA_DIR}" ] |
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,28 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
export JAVA_OPTIONS="${JAVA_OPTS} ${GN_CONFIG_PROPERTIES}" | ||
|
||
GN_BASE_DIR=/opt/geonetwork | ||
|
||
if ! command -v -- "$1" >/dev/null 2>&1 ; then | ||
set -- java -jar "$JETTY_HOME/start.jar" "$@" | ||
fi | ||
|
||
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 | ||
|
||
# Delegate on base image entrypoint to start jetty | ||
exec /docker-entrypoint.sh "$@" | ||
else | ||
exec "$@" | ||
fi | ||
|
||
# set XSRF cookie path on "/" | ||
RUN sed -i 's#<property name="cookieHttpOnly" value="false"/>#<property name="cookieHttpOnly" value="false"/><property name="cookiePath" value="/"/>#' \ | ||
${GN_BASE_DIR}/WEB-INF/config-security/config-security-core.xml |
17 changes: 17 additions & 0 deletions
17
support-services/gn4/jetty/geonetwork_context_template.xml
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> |