From 8b184bd6d5b269b31181c3f6cf16c87f77919a18 Mon Sep 17 00:00:00 2001 From: erickgonzalez Date: Tue, 2 Jul 2024 17:02:06 -0600 Subject: [PATCH] #27537 #27871 include in 23.10.24 LTS --- docker/java-base/Dockerfile | 31 +++----- docker/pg-base/Dockerfile | 4 +- dotCMS/hotfix_tracking.md | 4 +- ...Maintenance_Resource-Download_DB_Dump.json | 75 +++++-------------- dotCMS/src/main/docker/original/Dockerfile | 15 +++- 5 files changed, 48 insertions(+), 81 deletions(-) diff --git a/docker/java-base/Dockerfile b/docker/java-base/Dockerfile index a24bd9e84092..63f8cf3f7f37 100644 --- a/docker/java-base/Dockerfile +++ b/docker/java-base/Dockerfile @@ -17,26 +17,9 @@ RUN apt update && \ apt upgrade -y && \ apt install -y --no-install-recommends zip unzip wget libtcnative-1 tzdata tini ca-certificates openssl libapr1 libpq-dev - # Install curl RUN wget -O - https://repo.dotcms.com/artifactory/ext-release-local/com/dotcms/curl-static/curl-`uname -m` | install /dev/stdin /usr/bin/curl && \ - chmod a+x /usr/bin/curl - -# Downloading sdkman -#RUN curl -sL "https://get.sdkman.io" | bash - -# Installing Java via sdkman - # Modules included - # java.naming - javax/naming/NamingException - # java.desktop - java/beans/PropertyEditorSupport - # java.management - javax/management/MBeanServer - # java.security.jgss - org/ietf/jgss/GSSException - # java.instrument - java/lang/instrument/IllegalClassFormatException - # jdk.unsupported - sun/misc/Unsafe, needed by caffine - # java.scripting - Nashhorn, needed by log4j - # java.rmi needed by Quartz - # jdk.compiler needed to build - # jdk.zipfs needed for gradle + chmod a+x /usr/bin/curl RUN jlink \ --verbose \ @@ -45,7 +28,17 @@ RUN jlink \ --compress 2 \ --no-header-files \ --no-man-pages \ - --output "$JAVA_OUTPUT_DIR" + --output "$JAVA_OUTPUT_DIR" + +# install postgres clients, for pg_dump +ARG PG_BUILD_PACKAGES="postgresql-common gnupg" + +RUN apt install -y --no-install-recommends $PG_BUILD_PACKAGES \ + && /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y \ + && apt install -y postgresql-client-16 \ + && apt purge -y $PG_BUILD_PACKAGES + +RUN /usr/bin/pg_dump --version || exit 1 # Cleanup RUN rm -rf /root/.sdkman && \ diff --git a/docker/pg-base/Dockerfile b/docker/pg-base/Dockerfile index f450cf9fb726..cc9da8d87e7e 100644 --- a/docker/pg-base/Dockerfile +++ b/docker/pg-base/Dockerfile @@ -7,7 +7,7 @@ SHELL ["/bin/bash", "-c"] ARG DEBIAN_FRONTEND=noninteractive # see https://www.postgresql.org/ftp/source/ for versions -ARG POSTGRES_VERSION=15.3 +ARG POSTGRES_VERSION=16.2 ARG POSTGRES_TARBALL=postgresql-${POSTGRES_VERSION}.tar.bz2 ARG FTP_PATH=https://ftp.postgresql.org/pub/source/v${POSTGRES_VERSION} @@ -17,7 +17,7 @@ ARG BUILD_DEPS="build-essential ca-certificates curl zlib1g-dev" # './configure --without-readline' currently means we won't have shared library # dependencies that are not present in the dotcms image -ARG CONFIGURE_OPTS="--without-readline" +ARG CONFIGURE_OPTS="--without-readline --without-icu" # builds client only - see https://www.postgresql.org/docs/current/install-procedure.html RUN apt update -y \ diff --git a/dotCMS/hotfix_tracking.md b/dotCMS/hotfix_tracking.md index 12fe58a0eeea..2f85cc02be75 100644 --- a/dotCMS/hotfix_tracking.md +++ b/dotCMS/hotfix_tracking.md @@ -122,4 +122,6 @@ This maintenance release includes the following code fixes: 115. https://github.com/dotCMS/core/issues/23131 : Remove 10k Push Publishing Limit #23131 116. https://github.com/dotCMS/core/issues/28897 : Content Resource v1 hits the db #28897 117. https://github.com/dotCMS/core/issues/28890 : LanguageUtil.getLanguageId is always hitting the db #28890 -118. https://github.com/dotCMS/core/issues/26421 : Block Editor: Add align-justify option to menu #26421 \ No newline at end of file +118. https://github.com/dotCMS/core/issues/26421 : Block Editor: Add align-justify option to menu #26421 +119. https://github.com/dotCMS/core/issues/27537 : Download database not working in latest version #27537 +120. https://github.com/dotCMS/core/issues/27871 : refactor pg_dump inclusion in our docker image #27871 \ No newline at end of file diff --git a/dotCMS/src/curl-test/Maintenance_Resource-Download_DB_Dump.json b/dotCMS/src/curl-test/Maintenance_Resource-Download_DB_Dump.json index 583c0a75c206..c6ba718d19d7 100644 --- a/dotCMS/src/curl-test/Maintenance_Resource-Download_DB_Dump.json +++ b/dotCMS/src/curl-test/Maintenance_Resource-Download_DB_Dump.json @@ -6,14 +6,21 @@ }, "item": [ { - "name": "exclude DB Dump", + "name": "Is pg_dump available", "event": [ { "listen": "test", "script": { "exec": [ - "// ignore Download DB Dump collection", - "postman.setNextRequest(\"invalidateSession\")" + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"The 'pg_dump' tool must be available\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData).to.eql(true, \"The 'pg_dump' tool is NOT available\");", + "});", + "" ], "type": "text/javascript" } @@ -38,14 +45,15 @@ "method": "GET", "header": [], "url": { - "raw": "{{serverURL}}/api/v1/logger", + "raw": "{{serverURL}}/api/v1/maintenance/_pgDumpAvailable", "host": [ "{{serverURL}}" ], "path": [ "api", "v1", - "logger" + "maintenance", + "_pgDumpAvailable" ] } }, @@ -58,7 +66,7 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 200\", function () {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});", "" @@ -100,55 +108,6 @@ }, "response": [] }, - { - "name": "Is pg_dump available", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code should be 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/maintenance/_pgDumpAvailable", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "maintenance", - "_pgDumpAvailable" - ] - } - }, - "response": [] - }, { "name": "invalidateSession", "event": [ @@ -156,7 +115,7 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200\", function () {", + "pm.test(\"HTTP Status code must be 200\", function () {", " pm.response.to.have.status(200);", "});" ], @@ -188,11 +147,11 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"Status code should be 401\", function () {", + "pm.test(\"HTTP Status code must be 401\", function () {", " pm.response.to.have.status(401);", "});", "", - "pm.test(\"Valid response\", function () {", + "pm.test(\"Expected 'Invalid User' error must be present\", function () {", " pm.expect(pm.response.text()).to.include(\"Invalid User\");", "});", "" diff --git a/dotCMS/src/main/docker/original/Dockerfile b/dotCMS/src/main/docker/original/Dockerfile index 8e284667f4a4..ac0ac7e97e5a 100644 --- a/dotCMS/src/main/docker/original/Dockerfile +++ b/dotCMS/src/main/docker/original/Dockerfile @@ -48,11 +48,24 @@ RUN find /srv/ -type f -name "*.sh" -exec chmod a+x {} \; && \ mkdir -p /data/local/dotsecure/license && \ chown -R $USER_NAME:$USER_NAME /data +# ---------------------------------------------- +# Stage 3: Flatten everything to 1 layer +# ---------------------------------------------- +FROM scratch + +LABEL com.dotcms.contact "support@dotcms.com" +LABEL com.dotcms.vendor "dotCMS LLC" +LABEL com.dotcms.description "dotCMS Content Management System" + +ARG USER_UID="65001" +ARG USER_GID="65001" + +COPY --from=container-base / / # Switching to non-root user to install SDKMAN! USER $USER_UID:$USER_GID ENV JAVA_HOME="/java" -ENV PATH=$PATH:/java/bin:/usr/local/pgsql/bin +ENV PATH=$PATH:/java/bin ENTRYPOINT ["/usr/bin/tini", "--", "/srv/entrypoint.sh"] CMD ["dotcms"]