diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index 1402266a47..2d1497927b 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -38,6 +38,10 @@ RUN $BUILD_SCRIPTS_DIR/docs_part_2.sh RUN $BUILD_SCRIPTS_DIR/gzip.sh +RUN mkdir /temp-docs +RUN mv /target/jekyll-webapp/docs /temp-docs +RUN ls /target/jekyll-webapp + # # # @@ -48,7 +52,18 @@ COPY .mvn /.mvn COPY pom.xml / COPY --from=docs --chown=1001:0 /src /src COPY --from=docs --chown=1001:0 /target /target +# Maven does not need to know about the large amount of files generated by Antora. The antora files only need to be +# correctly placed on the file system so that the openliberty.io application can serve the files to browsers. +# When the Antora files are placed in the /target directory, this forces Maven to deal with too many files. +# Maven will encouter a JVM crash because there are too many files related to docs. + +# Part 1: Remove the docs files so Maven does not need to deal with them. +RUN rm -rf /target/jekyll-webapp/docs +# Part 2: Build the Java application RUN ./mvnw -B -Dhttps.protocols=TLSv1.2 compile war:exploded +# Part 3: Restore the doc files that were previously removed +RUN mkdir target/openliberty-website-1.0-SNAPSHOT/docs +COPY --from=docs --chown=1001:0 /temp-docs/docs /target/openliberty-website-1.0-SNAPSHOT/docs # # diff --git a/docker/Dockerfile.staging b/docker/Dockerfile.staging index b61a9d9b93..fd8f2168c0 100644 --- a/docker/Dockerfile.staging +++ b/docker/Dockerfile.staging @@ -35,6 +35,10 @@ RUN $BUILD_SCRIPTS_DIR/docs_part_2.sh RUN $BUILD_SCRIPTS_DIR/gzip.sh +RUN mkdir /temp-docs +RUN mv /target/jekyll-webapp/docs /temp-docs +RUN ls /target/jekyll-webapp + # # # @@ -45,7 +49,18 @@ COPY .mvn /.mvn COPY pom.xml / COPY --from=docs --chown=1001:0 /src /src COPY --from=docs --chown=1001:0 /target /target +# Maven does not need to know about the large amount of files generated by Antora. The antora files only need to be +# correctly placed on the file system so that the openliberty.io application can serve the files to browsers. +# When the Antora files are placed in the /target directory, this forces Maven to deal with too many files. +# Maven will encouter a JVM crash because there are too many files related to docs. + +# Part 1: Remove the docs files so Maven does not need to deal with them. +RUN rm -rf /target/jekyll-webapp/docs +# Part 2: Build the Java application RUN ./mvnw -B -Dhttps.protocols=TLSv1.2 compile war:exploded +# Part 3: Restore the doc files that were previously removed +RUN mkdir target/openliberty-website-1.0-SNAPSHOT/docs +COPY --from=docs --chown=1001:0 /temp-docs/docs /target/openliberty-website-1.0-SNAPSHOT/docs # # diff --git a/scripts/build/docs_part_1.sh b/scripts/build/docs_part_1.sh index 115f478aa2..4fe950a462 100755 --- a/scripts/build/docs_part_1.sh +++ b/scripts/build/docs_part_1.sh @@ -36,6 +36,7 @@ echo "Moving the Antora docs to the jekyll webapp" timer_start=$(date +%s) mkdir -p target/jekyll-webapp/docs/ cp -r src/main/content/docs/build/site/. target/jekyll-webapp/ +rm -rf src/main/content/docs/build timer_end=$(date +%s) echo "Total execution time for copying Antora docs to webapp: '$(date -u --date @$(( $timer_end - $timer_start )) +%H:%M:%S)'"