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 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Dockerfile (limited to '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"] -- cgit v1.2.3 From 6c78d011f735d14ac45f7eae9ab0d56fd17cc55e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 29 Sep 2017 09:46:14 +0200 Subject: Rename persistence unit to opendc-simulator Also changes the environment variables of the run-command to reflect the standard followed in the rest of the OpenDC codebase. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 3bc786ee..6346a940 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ USER gradle 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"] +CMD ["/bin/sh", "-c", "gradle run -Ppersistence.url=$(echo \"jdbc:mysql://mariadb:3306/\"$MYSQL_DATABASE) -Ppersistence.user=$MYSQL_USER -Ppersistence.password=$MYSQL_PASSWORD"] -- cgit v1.2.3 From a153e7abbb36594c27d918aa37dbf0fea17df3fe Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 29 Sep 2017 14:03:06 +0200 Subject: Steamline Docker integration This change improves the Docker integration by pre-building the application when building the image to prevent having to build the application at runtime. --- Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 6346a940..f8de6b54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,19 @@ FROM gradle:alpine MAINTAINER Fabian Mastenbroek # Copy OpenDC simulator -COPY ./ /simulator +COPY ./ /home/gradle/simulator # Fix permissions USER root -RUN chown -R gradle:gradle /simulator +RUN chown -R gradle:gradle /home/gradle/simulator && \ + chmod -R 771 /home/gradle/simulator USER gradle # Set the working directory to the JPA integration -WORKDIR /simulator/opendc-integration-jpa +WORKDIR /home/gradle/simulator/opendc-integration-jpa + +# Build the application +RUN gradle --no-daemon installDist # Run the application -CMD ["/bin/sh", "-c", "gradle run -Ppersistence.url=$(echo \"jdbc:mysql://mariadb:3306/\"$MYSQL_DATABASE) -Ppersistence.user=$MYSQL_USER -Ppersistence.password=$MYSQL_PASSWORD"] +CMD build/install/opendc-integration-jpa/bin/opendc-integration-jpa -- cgit v1.2.3 From dad4487fddaccf44240f5d62fa83830f7bbf8a5d Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 24 Oct 2017 12:07:09 +0200 Subject: bug(#6): Improve Docker deployment This change improves the Docker deployment by moving the build process from runtime to (image) build time. Also, the opendc-integration-jpa module now consists of a core and mysql module, where the mysql module is a specific deployment of the integration. --- Dockerfile | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 Dockerfile (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f8de6b54..00000000 --- a/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM gradle:alpine -MAINTAINER Fabian Mastenbroek - -# Copy OpenDC simulator -COPY ./ /home/gradle/simulator - -# Fix permissions -USER root -RUN chown -R gradle:gradle /home/gradle/simulator && \ - chmod -R 771 /home/gradle/simulator -USER gradle - -# Set the working directory to the JPA integration -WORKDIR /home/gradle/simulator/opendc-integration-jpa - -# Build the application -RUN gradle --no-daemon installDist - -# Run the application -CMD build/install/opendc-integration-jpa/bin/opendc-integration-jpa -- cgit v1.2.3