spotfiresoftware / spotfire-cloud-deployment-kit

Vanilla recipes to build container images and Helm charts for Spotfire®
Apache License 2.0
17 stars 15 forks source link

Unable to build container image spotfire-base due to failure to install openjdk-17-jre-headless #14

Closed mjohanss-tibco closed 1 year ago

mjohanss-tibco commented 1 year ago
  1. Place build files / installers in containers/downloads
  2. make --directory=containers spotfire-base

Result

#0 19.32 Setting up ca-certificates-java (20190909) ...
#0 19.38 head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory
#0 19.47 Exception in thread "main" java.lang.InternalError: Error loading java.security file
#0 19.47        at java.base/java.security.Security.initialize(Security.java:106)
#0 19.47        at java.base/java.security.Security$1.run(Security.java:84)
#0 19.47        at java.base/java.security.Security$1.run(Security.java:82)
#0 19.47        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
#0 19.47        at java.base/java.security.Security.<clinit>(Security.java:82)
#0 19.47        at java.base/sun.security.jca.ProviderList.<init>(ProviderList.java:178)
#0 19.47        at java.base/sun.security.jca.ProviderList$2.run(ProviderList.java:96)
#0 19.47        at java.base/sun.security.jca.ProviderList$2.run(ProviderList.java:94)
#0 19.47        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
#0 19.47        at java.base/sun.security.jca.ProviderList.fromSecurityProperties(ProviderList.java:93)
#0 19.47        at java.base/sun.security.jca.Providers.<clinit>(Providers.java:55)
#0 19.47        at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:156)
#0 19.47        at java.base/java.security.cert.CertificateFactory.getInstance(CertificateFactory.java:193)
#0 19.47        at org.debian.security.KeyStoreHandler.<init>(KeyStoreHandler.java:50)
#0 19.47        at org.debian.security.UpdateCertificates.<init>(UpdateCertificates.java:65)
#0 19.47        at org.debian.security.UpdateCertificates.main(UpdateCertificates.java:51)
#0 19.49 dpkg: error processing package ca-certificates-java (--configure):
#0 19.49  installed ca-certificates-java package post-installation script subprocess returned error exit status 1
#0 19.49 dpkg: dependency problems prevent configuration of openjdk-17-jre-headless:amd64:
#0 19.49  openjdk-17-jre-headless:amd64 depends on ca-certificates-java (>= 20190405~); however:
#0 19.49   Package ca-certificates-java is not configured yet.
#0 19.49
#0 19.49 dpkg: error processing package openjdk-17-jre-headless:amd64 (--configure):
#0 19.49  dependency problems - leaving unconfigured
#0 19.49 Processing triggers for libc-bin (2.31-13+deb11u6) ...
#0 19.65 Processing triggers for ca-certificates (20210119) ...
#0 19.67 Updating certificates in /etc/ssl/certs...
#0 20.31 0 added, 0 removed; done.
#0 20.31 Running hooks in /etc/ca-certificates/update.d...
#0 20.32
#0 20.35 /etc/ca-certificates/update.d/jks-keystore: 82: java: not found
#0 20.35 E: /etc/ca-certificates/update.d/jks-keystore exited with code 1.
#0 20.35 done.
#0 20.38 Errors were encountered while processing:
#0 20.38  ca-certificates-java
#0 20.38  openjdk-17-jre-headless:amd64
#0 20.41 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
Dockerfile:19
--------------------
18 \|
19 \| >>> RUN apt-get update \
20 \| >>>   && apt-get upgrade -y \
21 \| >>>   && mkdir -p /usr/share/man/man1 \
22 \| >>>   && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
23 \| >>>      openjdk-17-jre-headless \
24 \| >>>      unzip \
25 \| >>>      cabextract \
26 \| >>>   && apt-get clean all
27 \|
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update   && apt-get upgrade -y   && mkdir -p /usr/share/man/man1   && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends      openjdk-17-jre-headless      unzip      cabextract   && apt-get clean all" did not complete successfully: exit code: 100
make: *** [Makefile:74: spotfire-base] Error 1
mjohanss-tibco commented 1 year ago

Temporary workaround.

Apply the following diff:

diff --git a/containers/spotfire-base/Dockerfile b/containers/spotfire-base/Dockerfile
index 1f89097..150e584 100755
--- a/containers/spotfire-base/Dockerfile
+++ b/containers/spotfire-base/Dockerfile
@@ -19,6 +19,8 @@ LABEL org.opencontainers.image.title="tibco/spotfire-base" \
 RUN apt-get update \
   && apt-get upgrade -y \
   && mkdir -p /usr/share/man/man1 \
+  && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+     ca-certificates-java \
   && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      openjdk-17-jre-headless \
      unzip \

containers/spotfire-base/Dockerfile contents after applying the diff:

#
# spotfire-base container for latest released stable Debian
#
ARG DEBIAN_TAG=11-slim

#
# common java-base
#
FROM debian:$DEBIAN_TAG as spotfire-base

ARG DEBIAN_TAG
LABEL org.opencontainers.image.title="tibco/spotfire-base" \
    org.opencontainers.image.description="Base image for TIBCO Spotfire® container images" \
    org.opencontainers.image.url='https://github.com/TIBCO/Spotfire-cloud-deployment-kit' \
    org.opencontainers.image.documentation='https://github.com/TIBCO/Spotfire-cloud-deployment-kit' \
    org.opencontainers.image.source='https://github.com/TIBCO/Spotfire-cloud-deployment-kit' \
    org.opencontainers.image.vendor='Cloud Software Group, Inc.'

RUN apt-get update \
  && apt-get upgrade -y \
  && mkdir -p /usr/share/man/man1 \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
     ca-certificates-java \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
     openjdk-17-jre-headless \
     unzip \
     cabextract \
  && apt-get clean all

RUN groupadd -g 1000 spotfire \
  && useradd --uid 1000 --gid 1000 --home /opt/tibco/ --shell=/bin/bash spotfire \
  && mkdir -p /opt/tibco/ \
  && chown -R spotfire:spotfire /opt/tibco/
rodrigoeiras commented 1 year ago

Worked.

mjohanss-tibco commented 1 year ago

Issue fixed in release 1.5.0.