2022-04-21 07:48:10 +00:00
|
|
|
version: "3"
|
|
|
|
|
|
|
|
services:
|
|
|
|
wildfly:
|
|
|
|
image: quay.io/wildfly/wildfly
|
2022-04-21 08:06:30 +00:00
|
|
|
container_name: wildfly
|
|
|
|
hostname: wildfly
|
2022-04-21 07:48:10 +00:00
|
|
|
ports:
|
2022-04-21 08:06:30 +00:00
|
|
|
- 8080:8080
|
|
|
|
- 9990:9990
|
2022-04-21 07:48:10 +00:00
|
|
|
volumes:
|
2022-04-21 08:06:30 +00:00
|
|
|
- ./build/libs/:/opt/jboss/wildfly/standalone/deployments/
|
2022-04-21 07:48:10 +00:00
|
|
|
environment:
|
2022-04-21 13:35:45 +00:00
|
|
|
- WILDFLY_USERNAME=admin
|
2022-04-21 07:48:10 +00:00
|
|
|
- WILDFLY_PASSWORD=password
|
2022-04-21 11:48:31 +00:00
|
|
|
- DB_PORT=3306
|
|
|
|
- DB_HOST=mariadb
|
2022-04-21 13:35:45 +00:00
|
|
|
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'
|
2022-04-21 11:48:31 +00:00
|
|
|
depends_on:
|
|
|
|
mariadb:
|
|
|
|
condition: service_healthy
|
2022-04-21 08:06:30 +00:00
|
|
|
restart: always
|
|
|
|
|
|
|
|
mariadb:
|
|
|
|
image: mariadb
|
|
|
|
container_name: mariadb
|
|
|
|
hostname: mariadb
|
|
|
|
environment:
|
|
|
|
- MYSQL_USER=user
|
|
|
|
- MYSQL_PASSWORD=mypassword
|
|
|
|
- MYSQL_DATABASE=mydatabase
|
|
|
|
- MYSQL_ROOT_PASSWORD=rootpassword
|
|
|
|
ports:
|
|
|
|
- 3306:3306
|
|
|
|
volumes:
|
|
|
|
- ./mariadb/:/var/lib/mysql/
|
2022-04-21 11:48:31 +00:00
|
|
|
healthcheck:
|
|
|
|
test:
|
|
|
|
[
|
|
|
|
"CMD-SHELL",
|
|
|
|
'mysqladmin -p$$MYSQL_ROOT_PASSWORD -h localhost ping | grep "mysqld is alive" || exit 1',
|
|
|
|
]
|
|
|
|
interval: 2s
|
|
|
|
retries: 10
|
2022-04-21 08:06:30 +00:00
|
|
|
restart: always
|
2022-04-21 07:48:10 +00:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
wildfly_data:
|
|
|
|
driver: local
|
2022-04-21 08:06:30 +00:00
|
|
|
mariadb:
|
|
|
|
driver: local
|