diff --git a/build.gradle b/build.gradle index 150b40c..54a06a2 100644 --- a/build.gradle +++ b/build.gradle @@ -23,8 +23,8 @@ dependencies { // Pour pouvoir parser le JSON implementation 'com.google.code.gson:gson:2.8.6' - // implementation 'org.hibernate:hibernate-core:5.4.30.Final' - // implementation 'mysql:mysql-connector-java:8.0.24' + implementation 'org.hibernate:hibernate-core:5.4.30.Final' + implementation 'mysql:mysql-connector-java:8.0.24' // des fonctions pratiques implementation 'org.apache.commons:commons-lang3:3.0' diff --git a/docker-compose.yml b/docker-compose.yml index ee1dc89..0b0e609 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,9 +11,31 @@ services: volumes: - ./build/libs/:/opt/jboss/wildfly/standalone/deployments/ environment: + - WILDFLY_USERNAME=admin - WILDFLY_PASSWORD=password - DB_PORT=3306 - DB_HOST=mariadb + command: > + bash -c ' + + ( + sleep 15 && + /opt/jboss/wildfly/bin/jboss-cli.sh \ + --connect controller=127.0.0.1 \ + --command=" \ + data-source add \ + --jndi-name=java:/MySqlDS \ + --name=MySQLDS \ + --connection-url=jdbc:mysql://$$DB_HOST:$$DB_PORT/mydatabase \ + --driver-name=backend.war_com.mysql.cj.jdbc.Driver_8_0 \ + --user-name=$$WILDFLY_USERNAME \ + --password=$$WILDFLY_PASSWORD \ + " + )& + + /opt/jboss/wildfly/bin/add-user.sh admin password --silent && + + /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0' depends_on: mariadb: condition: service_healthy