Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions render-ws-with-mongo-db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
#
# To build with CORS enabled only for https://neuroglancer-demo.appspot.com (the default build):
# cd ${RENDER_REPO_ROOT_DIR}
# docker build --file render-ws-with-mongo-db/Dockerfile --no-cache --build-arg CORS_ALLOWED_ORIGINS='https://neuroglancer-demo.appspot.com' --tag ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8 .
# docker build --file render-ws-with-mongo-db/Dockerfile --no-cache --build-arg CORS_ALLOWED_ORIGINS='https://neuroglancer-demo.appspot.com' --tag ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9 .
#
# To build with CORS enabled for all origins (note tag suffix '.cors-star'):
# cd ${RENDER_REPO_ROOT_DIR}
# docker build --file render-ws-with-mongo-db/Dockerfile --no-cache --build-arg CORS_ALLOWED_ORIGINS='*' --tag ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8.cors-star .
# docker build --file render-ws-with-mongo-db/Dockerfile --no-cache --build-arg CORS_ALLOWED_ORIGINS='*' --tag ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9.cors-star .
#
# To run a container in detached mode:
# docker run --publish 8080:8080 --detach --rm ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8
# docker run --publish 8080:8080 --detach --rm ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9
#
# To run a container in detached mode with the standard MongoDB dump directory mounted:
# docker run --publish 8080:8080 --detach --rm --mount type=bind,source=/mnt/disks/mongodb_dump_fs/dump,target=/mnt/disks/mongodb_dump_fs/dump ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8
# docker run --publish 8080:8080 --detach --rm --mount type=bind,source=/mnt/disks/mongodb_dump_fs/dump,target=/mnt/disks/mongodb_dump_fs/dump ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9
#
# To run a container with 4GB headroom and the test/two_z_with_four_tiles/mongodb/render collections loaded at startup:
# docker run --publish 8080:8080 --detach --rm ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8 4 test/two_z_with_four_tiles/mongodb/render
# docker run --publish 8080:8080 --detach --rm ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9 4 test/two_z_with_four_tiles/mongodb/render
#
# To launch an interactive bash shell within a new container:
# docker run --interactive --tty --publish 8080:8080 --entrypoint /bin/bash --rm ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8
# docker run --interactive --tty --publish 8080:8080 --entrypoint /bin/bash --rm ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9
#
# To launch an interactive bash shell within an already running container:
# docker ps -a # to get the container id
Expand All @@ -37,7 +37,7 @@
# docker exec --interactive --tty "$(docker ps -q)" /bin/bash
#
# To push the image to the janeliascicomp containers GitHub registry (see https://github.com/JaneliaSciComp/containers/tree/main):
# docker push ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.8
# docker push ghcr.io/janeliascicomp/render-ws-with-mongodb:1.0.9
#
# Published Containers Notes:
# - Before pushing, your docker instance needs to be logged in to GitHub.
Expand Down Expand Up @@ -85,20 +85,26 @@ RUN if [ -n "${CORS_ALLOWED_ORIGINS}" ]; then \
./render-ws/src/main/webapp/WEB-INF/web.xml; \
fi

# 4. Build only the render-app and render-ws modules and skip tests
RUN { echo 'JAVA_HOME="$(readlink -m ./deploy/*jdk*)"'; } >> ~/.mavenrc && \
mvn --version; mvn --batch-mode --projects ".,render-app,render-ws" -Dproject.build.sourceEncoding=UTF-8 -Dmaven.test.skip package

# 4. Build only the render-app and render-ws modules and skip tests, then
# 5. Deploy Web Service and remove all unneeded source and build artifacts
# leaving only render/deploy and render/startup_mongodb_and_jetty.sh
#
# The build and the removal must be in the same RUN. Files removed by a later RUN are only hidden,
# they stay in the earlier layer and so in the image, where vulnerability scanners find them. This
# matters for /root/.m2, which holds every library and maven plugin dependency downloaded by the build
# (e.g. an old log4j-core pulled in by a plugin, since pom-scijava's managed versions only apply to
# project dependencies), and for the exploded render-ws/target webapp directory.
#
# The neuroglancer build is deployed as its own webapp next to render-ws.war so that it is served
# from http://<host>:8080/ng/ . Serving it from the same origin as http://<host>:8080/render-ws/v1/
# avoids the CORS and mixed content restrictions that block a neuroglancer hosted elsewhere from
# reading render data over plain http.
#
# NOTE: the ng copy must happen before the rm -rf below removes the render-ws-with-mongo-db directory.
RUN cp render-ws/target/render-ws-*.war deploy/jetty_base/webapps/render-ws.war && \
RUN { echo 'JAVA_HOME="$(readlink -m ./deploy/*jdk*)"'; } >> ~/.mavenrc && \
mvn --version && \
mvn --batch-mode --projects ".,render-app,render-ws" -Dproject.build.sourceEncoding=UTF-8 -Dmaven.test.skip package && \
cp render-ws/target/render-ws-*.war deploy/jetty_base/webapps/render-ws.war && \
cp -r ./render-ws-with-mongo-db/ng deploy/jetty_base/webapps/ng && \
rm -rf .[dgi]* Dockerfile LICENSE README.md docker-build-and-push.sh docs examples pom.xml \
render-app render-ws render-ws-java-client render-ws-spark-client render-ws-with-mongo-db trakem2-scripts \
Expand Down
9 changes: 9 additions & 0 deletions render-ws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<!-- Overrides the 3.4.2.Final from resteasy-bom, whose embedded pom.xml declares a (test scoped)
log4j-core 2.11.2 dependency that VM vulnerability scanners report as CVE-2021-45046.
The 3.6.x pom declares log4j 2.25.x. Explicit entries take precedence over imported boms. -->
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -264,6 +272,7 @@

<properties>
<resteasy.version>4.7.9.Final</resteasy.version>
<jboss-logging.version>3.6.3.Final</jboss-logging.version>
<jetty.version>10.0.26</jetty.version> <!-- NOTE: jetty version should be kept in sync with values in render/Dockerfile and render/render-ws/src/main/scripts/install.sh -->
<mongodb.driver.version>4.4.1</mongodb.driver.version>
<license.licenseName>gpl_v2</license.licenseName>
Expand Down
Loading