From 681718e6e59d7b2e14fd7428daebe15647a12097 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 28 Sep 2017 22:48:47 +0200 Subject: Add Dockerfile for the JPA integration This change adds a Dockerfile to the repository which will automatically launch the JPA integration. --- Dockerfile | 16 ++++++++++++++++ opendc-integration-jpa/build.gradle | 10 ++++++++++ .../src/main/resources/META-INF/persistence.xml | 6 +++--- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3bc786ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM gradle:alpine +MAINTAINER Fabian Mastenbroek + +# Copy OpenDC simulator +COPY ./ /simulator + +# Fix permissions +USER root +RUN chown -R gradle:gradle /simulator +USER gradle + +# Set the working directory to the JPA integration +WORKDIR /simulator/opendc-integration-jpa + +# Run the application +CMD ["/bin/sh", "-c", "gradle run -Ppersistence.url=$PERSISTENCE_URL -Ppersistence.user=$PERSISTENCE_USER -Ppersistence.password=$PERSISTENCE_PASSWORD"] diff --git a/opendc-integration-jpa/build.gradle b/opendc-integration-jpa/build.gradle index 4d0729b7..e5be0f46 100644 --- a/opendc-integration-jpa/build.gradle +++ b/opendc-integration-jpa/build.gradle @@ -80,6 +80,16 @@ repositories { jcenter() } +import org.apache.tools.ant.filters.* + +processResources { + filter ReplaceTokens, tokens: [ + 'persistence.url': project.findProperty('persistence.url') ?: '', + 'persistence.user': project.findProperty('persistence.user') ?: '', + 'persistence.password': project.findProperty('persistence.password') ?: '', + ] +} + dependencies { compile project(':opendc-core') compile project(':opendc-stdlib') diff --git a/opendc-integration-jpa/src/main/resources/META-INF/persistence.xml b/opendc-integration-jpa/src/main/resources/META-INF/persistence.xml index ad10286f..5b01b38e 100644 --- a/opendc-integration-jpa/src/main/resources/META-INF/persistence.xml +++ b/opendc-integration-jpa/src/main/resources/META-INF/persistence.xml @@ -32,9 +32,9 @@ jpa/schema.xml - - - + + + -- cgit v1.2.3