From bed9c984c0390839d87835471f72683ac3e4a159 Mon Sep 17 00:00:00 2001 From: Greg Miller Date: Mon, 18 Dec 2023 21:26:51 +0400 Subject: [PATCH 1/5] #905 Rewrite Dockerfile to Alpine image --- deploy/docker/Dockerfile | 45 ++++++++++------------------------------ 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index 37e164e49b..c542f8e7cb 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -1,51 +1,28 @@ -FROM ubuntu:23.04 +FROM alpine:3.19 MAINTAINER DBeaver Corp, devops@dbeaver.com -RUN set -eux; \ - apt-get update; \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - # curl required for historical reasons, see https://github.com/adoptium/containers/issues/255 - curl \ - # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory - # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager - # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 - fontconfig \ - # utilities for keeping Ubuntu and OpenJDK CA certificates in sync - # https://github.com/adoptium/containers/issues/293 - ca-certificates p11-kit \ - # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 - # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory - binutils \ - tzdata \ - # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 - locales \ - nano \ - ; \ - echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \ - locale-gen en_US.UTF-8; \ - rm -rf /var/lib/apt/lists/* +RUN apk update && apk --no-cache add bash nano ENV LANG=en_US.UTF-8 ENV JAVA_HOME=/opt/java/openjdk -COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME -ENV PATH="${JAVA_HOME}/bin:${PATH}" -RUN set -eux; \ - # https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472 - find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \ - ldconfig; \ - # https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840 - # https://openjdk.java.net/jeps/341 - java -Xshare:dump; +COPY --from=eclipse-temurin:17-alpine $JAVA_HOME $JAVA_HOME + +ENV PATH="${JAVA_HOME}/bin:${PATH}" ### Patch java security COPY java.security* ${JAVA_HOME}/conf/security/java.security COPY cloudbeaver /opt/cloudbeaver -EXPOSE 8978 RUN find /opt/cloudbeaver -type d -exec chmod 775 {} \; + WORKDIR /opt/cloudbeaver/ + +EXPOSE 8978 + +RUN chmod +x run-server.sh + ENTRYPOINT ["./run-server.sh"] From aa8189c9ebe901fabcc269b19092cabb27947628 Mon Sep 17 00:00:00 2001 From: Greg Miller Date: Tue, 19 Dec 2023 12:10:09 +0400 Subject: [PATCH 2/5] #905 fix --- deploy/docker/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index c542f8e7cb..cb6df8d4b5 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -23,6 +23,4 @@ WORKDIR /opt/cloudbeaver/ EXPOSE 8978 -RUN chmod +x run-server.sh - ENTRYPOINT ["./run-server.sh"] From 4a55f5a425749908bf3c606fc2a440a19ee88f2a Mon Sep 17 00:00:00 2001 From: Greg Miller Date: Tue, 19 Dec 2023 15:30:41 +0400 Subject: [PATCH 3/5] #905 Added alpine packeges --- deploy/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index cb6df8d4b5..ddad066f92 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.19 MAINTAINER DBeaver Corp, devops@dbeaver.com -RUN apk update && apk --no-cache add bash nano +RUN apk update && apk --no-cache add p11-kit ca-certificates openssh-client bash nano ENV LANG=en_US.UTF-8 From 9ea97aa54ec4ac038b91f6035be5ee1d9ed52b9f Mon Sep 17 00:00:00 2001 From: Greg Miller Date: Mon, 25 Dec 2023 15:02:12 +0400 Subject: [PATCH 4/5] #905 Added packeges to Dockerfile --- deploy/docker/Dockerfile | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index ddad066f92..cad7099e43 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -2,9 +2,30 @@ FROM alpine:3.19 MAINTAINER DBeaver Corp, devops@dbeaver.com -RUN apk update && apk --no-cache add p11-kit ca-certificates openssh-client bash nano - -ENV LANG=en_US.UTF-8 +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' + +RUN set -eux; \ + apk add --no-cache \ + # java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory + # java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager + # https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077 + fontconfig ttf-dejavu \ + # utilities for keeping Alpine and OpenJDK CA certificates in sync + # https://github.com/adoptium/containers/issues/293 + ca-certificates p11-kit-trust \ + # locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8 + musl-locales musl-locales-lang \ + # jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351 + # Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory + binutils \ + tzdata \ + bash \ + nano \ + curl \ + ; \ + rm -rf /var/cache/apk/* + +ENV JAVA_VERSION jdk-17.0.9+9 ENV JAVA_HOME=/opt/java/openjdk From a37aae9c23b74bc21cfe6a6e935cf061c79ae5f4 Mon Sep 17 00:00:00 2001 From: Greg Miller Date: Tue, 26 Dec 2023 02:23:51 +0400 Subject: [PATCH 5/5] #905 Added sqlite-jdbc driver to lib --- deploy/docker/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index cad7099e43..fa9f3afd86 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -27,6 +27,13 @@ RUN set -eux; \ ENV JAVA_VERSION jdk-17.0.9+9 +RUN wget https://github.com/xerial/sqlite-jdbc/releases/download/3.44.1.0/sqlite-jdbc-3.44.1.0.jar && \ + unzip -j sqlite-jdbc-*.jar "org/sqlite/native/$(uname -s)/$(uname -m)/libsqlitejdbc.so" && \ + mv libsqlitejdbc.so /usr/lib && \ + rm -rf sqlite-jdbc-*.jar + +ENV JAVA_HOME=/opt/java/openjdk + ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:17-alpine $JAVA_HOME $JAVA_HOME