From dd35a35539291c496587b39beab6d091ef81fdab Mon Sep 17 00:00:00 2001 From: Karl Tarbet Date: Tue, 2 Jan 2024 19:06:22 +0000 Subject: [PATCH] fix for issue #487 --- Dockerfile | 2 ++ compose_files/pki/certs/installcerts.sh | 10 ++++++++++ docker-compose.yml | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 compose_files/pki/certs/installcerts.sh diff --git a/Dockerfile b/Dockerfile index b6cd5d4c5..9e4aa4cce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,8 @@ RUN gradle clean prepareDockerBuild --info --no-daemon FROM alpine:3.19.0 as tomcat_base RUN apk update && apk upgrade --no-cache RUN apk add openjdk8-jre curl +RUN apk add --no-cache bash + RUN mkdir /download && \ cd /download && \ diff --git a/compose_files/pki/certs/installcerts.sh b/compose_files/pki/certs/installcerts.sh new file mode 100755 index 000000000..05598712c --- /dev/null +++ b/compose_files/pki/certs/installcerts.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# install certs for use in docker dev environment +CERT_DIR="/etc/ssl/certs/java/cacerts" + +if keytool -list -keystore ${CERT_DIR} -alias cda_lab_root -storepass changeit > /dev/null; then + echo "Alias exists, deleting..." + keytool -delete -alias cda_lab_root -keystore ${CERT_DIR} -storepass changeit +fi +echo "Importing certificate..." +keytool -trustcacerts -importcert -alias cda_lab_root -keystore ${CERT_DIR} -storepass changeit -file /conf/rootca.pem -noprompt diff --git a/docker-compose.yml b/docker-compose.yml index 14e7b583d..233b011f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -78,7 +78,7 @@ services: target: api context: . dockerfile: Dockerfile - command: bash -c "keytool -trustcacerts -importcert -alias cda_lab_root -keystore /opt/java/openjdk/jre/lib/security/cacerts -storepass changeit -file /conf/rootca.pem -noprompt || catalina.sh run" + command: bash -c "/conf/installcerts.sh && /usr/local/tomcat/bin/catalina.sh run" restart: unless-stopped volumes: - ./compose_files/pki/certs:/conf/ @@ -162,4 +162,4 @@ services: - "traefik.http.routers.api.rule=Host(`traefik.test`)" - "traefik.http.routers.api.entryPoints=traefik" - "traefik.http.routers.api.service=api@internal" - - "traefik.http.routers.api.tls=true" \ No newline at end of file + - "traefik.http.routers.api.tls=true"