Merge pull request #54 from CodeAndChoke/adddockercompose

Add docker compose
This commit is contained in:
James Agnew
2019-10-01 15:17:45 -04:00
committed by GitHub
2 changed files with 41 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ To configure the starter app to use MySQL, instead of the default Derby, update
* datasource.driver=com.mysql.jdbc.Driver
* datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3
* hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
* datasource.username=admin
* datasource.password=admin
Because the integration tests within the project rely on the default Derby database configuration, it is important to either explicity skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured MySQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure.
@@ -72,6 +74,24 @@ Again, browse to the following link to use the server (note that the port 8080 m
[http://localhost:8080/hapi-fhir-jpaserver/](http://localhost:8080/hapi-fhir-jpaserver/)
# Deploy with docker compose
Docker compose is a simple option to build and deploy container. To deploy with docker compose, you should build the project
with ```mvn clean install``` and then bring up the containers with ```docker-compose up -d --build```. The server can be
reached at http://localhost:8080/hapi-fhir-jpaserver/.
In order to use another port, change the `ports` parameter
inside ``docker-compose.yml`` to ```8888:8080```, where 8888 is a port of your choice.
The docker compose set also includes my MySQL database, if you choose to use MySQL instead of derby, change the following
properties in hapi.properties:
* datasource.driver=com.mysql.jdbc.Driver
* datasource.url=jdbc:mysql://hapi-fhir-mysql:3306/hapi
* hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
* datasource.username=admin
* datasource.password=admin
# Running hapi-fhir-jpaserver-example in Tomcat from IntelliJ
Install Tomcat.

21
docker-compose.yml Normal file
View File

@@ -0,0 +1,21 @@
version: "3"
services:
hapi-fhir-jpaserver-start:
build: .
container_name: hapi-fhir-jpaserver-start
restart: on-failure
ports:
- "8080:8080"
hapi-fhir-mysql:
image: mysql:latest
container_name: hapi-fhir-mysql
restart: always
environment:
MYSQL_DATABASE: 'hapi'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: 'admin'
MYSQL_ROOT_PASSWORD: 'admin'
volumes:
- hapi-fhir-mysql:/var/lib/mysql
volumes:
hapi-fhir-mysql: