How to build working Geoserver docker image from source?

73 Views Asked by At

I want to build Geoserver from source and create a docker image for putting it in a cluster. The building process works, but running the resulting startup.sh gives ERROR: Nothing to start, exiting ....

I suspect it is a problem of the mvn install command, because a diff of the resulting with the previous working container reveals only differences in the .jar files, not in config files or start.ini.

Previously I simply downloaded and installed https://sourceforge.net/projects/geoserver/files/GeoServer/2.21.1/geoserver-2.21.1-bin.zip and it worked. Now I fail to find out which build commands to use to reproduce the same artifacts as present in sourceforge, and would be thankful for any tips.

The current approach is the following, and it manages to build but gives the above error when running the docker image.

FROM openjdk:11

RUN apt-get update && apt-get install -y git maven

RUN mkdir /tmp/geoserver

RUN cd /tmp/geoserver && git clone https://github.com/geoserver/geoserver.git
RUN cd /tmp/geoserver/geoserver/src && \
    git checkout 2.21.1 && \
    mvn dependency:resolve

RUN cd /tmp/geoserver/geoserver/src && \
    mvn clean install -DskipTests -P release,importer -DconfigId=release -DconfigDirectory=/tmp/geoserver/geoserver/data

RUN cd /tmp/geoserver/geoserver/src && \
    mvn assembly:single -nsu -N

RUN mkdir /tmp/geoserver/server
RUN mkdir /tmp/geoserver/importer

RUN unzip -d /tmp/geoserver/server /tmp/geoserver/geoserver/src/target/release/geoserver-2.21.1-bin.zip
RUN unzip -d /tmp/geoserver/importer /tmp/geoserver/geoserver/src/target/release/geoserver-2.21.1-importer-plugin.zip
RUN mv /tmp/geoserver/importer/* /tmp/geoserver/server/webapps/geoserver/WEB-INF/lib
RUN mkdir /app
RUN mv /tmp/geoserver/server/* /app
RUN rm -rf /tmp/geoserver

RUN echo "This is a test" > /app/hellooo.txt

ENV GEOSERVER_HOME=$WORKDIR/app

ENTRYPOINT ["/app/bin/startup.sh"]
EXPOSE 8080
0

There are 0 best solutions below