diff --git a/README.md b/README.md index 94098ea..0790c13 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ +## Wildfly application server with PostgreSQL database driver -docker build -t tonda100/wildfly-postgresql . +This image contains Wildfly 10.1 server with PostgreSQL database driver. The project inherits from [tonda100/wildfly-empty](https://github.com/tonda100/wildfly-empty) project. At the build time or start you have to setup these enviroment variables +* DB_HOST - hostname or IP address of database +* DB_PORT - port of database +* DB_NAME - name of the database +* DB_USER - username used for connection to database +* DB_PASS - password user for connection to database +The connection string is then created as `jdbc:postgresql://$DB_HOST:$DB_PORT/$DB_NAME` more details see [startWithPostgres.sh](https://github.com/tonda100/wildfly-postgresql/blob/master/startWithPostgres.sh) -docker run -d --name postgres -p 5432:5432 --net=wildfly -e POSTGRES_USER=myapp -e POSTGRES_PASSWORD=my-password postgres:9.6.1 +### Test +Project can be tested with separate containers or via docker-compose. +`docker network create wildfly` +`docker run -d --name postgres -p 5432:5432 --net=wildfly -e POSTGRES_USER=myapp -e POSTGRES_PASSWORD=my-password postgres:9.6.1` +`docker run -d --name wildfly -p 8080:8080 --net=wildfly -e DB_HOST=postgres -e DB_NAME=myapp -e DB_USER=myapp -e DB_PASS=my-password tonda100/wildfly-postgresql` -docker run -d --name wildfly -p 8080:8080 --net=wildfly -e DB_HOST=postgres -e DB_USER=myapp -e DB_USER=myapp -e DB_PASS=my-password tonda100/wildfly-postgresql +Project is available on [GitHub](https://github.com/tonda100/wildfly-postgresql) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..90b566f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2' +services: + postgres: + image: postgres:9.6.1 + ports: + - "5432:5432" + environment: + - POSTGRES_USER=myapp + - POSTGRES_PASSWORD=my-password + wildfly: + image: tonda100/wildfly-postgresql + ports: + - "8080:8080" + environment: + - DB_HOST=postgres + - DB_NAME=myapp + - DB_USER=myapp + - DB_PASS=my-password + depends_on: + - postgres \ No newline at end of file