diff --git a/Dockerfile b/Dockerfile index 5989441..1525a4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,15 @@ -FROM tonda100/wildfly-empty +FROM jboss/wildfly:18.0.0.Final MAINTAINER Antonin Stoklasek +ENV WILDFLY_HOME /opt/jboss/wildfly +ENV DEPLOY_DIR ${WILDFLY_HOME}/standalone/deployments/ + +# setup timezone +ENV TZ=Europe/Prague +USER root +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +USER jboss + ENV DATASOURCE_NAME ApplicationDS ENV DATASOURCE_JNDI java:/ApplicationDS @@ -22,9 +31,8 @@ COPY startWithPostgres.sh $WILDFLY_HOME/bin USER root RUN chown jboss:jboss $WILDFLY_HOME/bin/startWithPostgres.sh RUN chmod 755 $WILDFLY_HOME/bin/startWithPostgres.sh -RUN yum -y install wget USER jboss -RUN wget -P /tmp https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar +COPY postgresql-42.2.8.jar /tmp -ENTRYPOINT $WILDFLY_HOME/bin/startWithPostgres.sh \ No newline at end of file +ENTRYPOINT $WILDFLY_HOME/bin/startWithPostgres.sh diff --git a/postgresql-42.2.8.jar b/postgresql-42.2.8.jar new file mode 100644 index 0000000..2566145 Binary files /dev/null and b/postgresql-42.2.8.jar differ diff --git a/startWithPostgres.sh b/startWithPostgres.sh index 2a68ff5..dd4ca82 100644 --- a/startWithPostgres.sh +++ b/startWithPostgres.sh @@ -21,11 +21,22 @@ $JBOSS_CLI -c << EOF batch # Add PostgreSQL driver -module add --name=org.postgres --resources=/tmp/postgresql-9.4.1212.jar --dependencies=javax.api,javax.transaction.api +module add --name=org.postgres --resources=/tmp/postgresql-42.2.8.jar --dependencies=javax.api,javax.transaction.api /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver) # Add the datasource -data-source add --jndi-name=$DATASOURCE_JNDI --name=$DATASOURCE_NAME --connection-url=jdbc:postgresql://$DB_HOST:$DB_PORT/$DB_NAME --driver-name=postgres --user-name=$DB_USER --password=$DB_PASS +data-source add \ + --jndi-name=$DATASOURCE_JNDI \ + --name=$DATASOURCE_NAME \ + --connection-url=jdbc:postgresql://$DB_HOST:$DB_PORT/$DB_NAME \ + --driver-name=postgres \ + --user-name=$DB_USER \ + --password=$DB_PASS \ + --check-valid-connection-sql="SELECT 1" \ + --background-validation=true \ + --background-validation-millis=60000 \ + --flush-strategy=IdleConnections \ + --min-pool-size=10 --max-pool-size=100 --pool-prefill=false # Execute the batch run-batch