Skip to content

Commit

Permalink
Updated Docker Tomcat keycloak to 9-jre11
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Dec 1, 2024
1 parent 6df4e75 commit 443a36d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
23 changes: 15 additions & 8 deletions docker/images/cerberus-as-tomcat-keycloak/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM tomcat:8-jre8-alpine
FROM tomcat:9-jre11-temurin

ENV LOG_ROOT_PATH /usr/local/tomcat/logs/

ENV KEYCLOACK_REALM Cerberus
ENV KEYCLOACK_CLIENT cerberus
ENV KEYCLOACK_URL http://192.168.1.1:8080/auth
ENV CATALINA_OPTS="-Dorg.cerberus.environment=prd -Dorg.cerberus.authentification=keycloak -Xmx1024m"
ENV KEYCLOACK_VERSION 8.0.2
ENV KEYCLOACK_TOMCAT8_ADAPTER_NAME keycloak-tomcat-adapter-dist-${KEYCLOACK_VERSION}
ENV KEYCLOACK_VERSION 18.0.1
ENV KEYCLOACK_TOMCAT8_ADAPTER_NAME keycloak-oidc-tomcat-adapter-${KEYCLOACK_VERSION}

ENV DATABASE_HOST cerberus-db-mysql
ENV DATABASE_PORT 3306
Expand All @@ -19,23 +19,30 @@ ARG CERBERUS_NAME=cerberus-core
ARG CERBERUS_VERSION=4.18
ARG CERBERUS_PACKAGE_NAME=${CERBERUS_NAME}-${CERBERUS_VERSION}

ARG MYSQL_JAVA_CONNECTOR_VERSION=5.1.47
ARG MYSQL_JAVA_CONNECTOR_NAME=mysql-connector-java-${MYSQL_JAVA_CONNECTOR_VERSION}
ARG MYSQL_JAVA_CONNECTOR_VERSION=9.0.0
ARG MYSQL_JAVA_CONNECTOR_NAME=mysql-connector-j-${MYSQL_JAVA_CONNECTOR_VERSION}


RUN apt-get update -qqy \
&& apt-get -qqy install \
unzip dos2unix \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Download and install MySQL JDBC Drivers
RUN echo "Download & install MySQL JDBC Drivers" && \
wget -P /tmp/ https://downloads.mysql.com/archives/get/p/3/file/${MYSQL_JAVA_CONNECTOR_NAME}.zip && \
unzip -q -d /tmp/ /tmp/${MYSQL_JAVA_CONNECTOR_NAME}.zip && \
mv /tmp/${MYSQL_JAVA_CONNECTOR_NAME}/${MYSQL_JAVA_CONNECTOR_NAME}-bin.jar /usr/local/tomcat/lib/ && \
mv /tmp/${MYSQL_JAVA_CONNECTOR_NAME}/${MYSQL_JAVA_CONNECTOR_NAME}.jar /usr/local/tomcat/lib/ && \
echo "Clean temp directory" && \
rm /tmp/* -rf
#COPY mysql-connector-java-5.1.20-bin.jar /usr/local/tomcat/lib/

# Only for debug purpose
#RUN ls -al /usr/local/tomcat/lib/

# https://github.com/keycloak/keycloak/releases/download/${KEYCLOACK_VERSION}/keycloak-oidc-tomcat-adapter-${KEYCLOACK_VERSION}.zip
# https://downloads.jboss.org/keycloak/${KEYCLOACK_VERSION}/adapters/keycloak-oidc/${KEYCLOACK_TOMCAT8_ADAPTER_NAME}.zip
# Download & install KeyCloak adapter to manage authentification with Tomcat
RUN wget -P /tmp/ https://downloads.jboss.org/keycloak/${KEYCLOACK_VERSION}/adapters/keycloak-oidc/${KEYCLOACK_TOMCAT8_ADAPTER_NAME}.zip && \
RUN wget -P /tmp/ https://github.com/keycloak/keycloak/releases/download/${KEYCLOACK_VERSION}/${KEYCLOACK_TOMCAT8_ADAPTER_NAME}.zip && \
unzip -q -d /usr/local/tomcat/lib/ /tmp/${KEYCLOACK_TOMCAT8_ADAPTER_NAME}.zip && \
echo "Clean temp directory" && \
rm /tmp/* -rf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

<ResourceLink name="jdbc/cerberusprd"
Expand Down
5 changes: 3 additions & 2 deletions docker/images/cerberus-as-tomcat-keycloak/latest/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
testWhileIdle="true"
username="${DATABASE_USER}"
password="${DATABASE_PASSWORD}"
driverClassName="com.mysql.jdbc.Driver"
driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}"/>


Expand Down Expand Up @@ -130,8 +130,9 @@
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

-->

<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
Expand Down

0 comments on commit 443a36d

Please sign in to comment.