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