summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2017-09-29 14:03:06 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2017-09-29 14:40:48 +0200
commita153e7abbb36594c27d918aa37dbf0fea17df3fe (patch)
treea63e559fccf0ed28e82df5c03ba9cc92810a9aae /Dockerfile
parentd32b0a0046038770bd6e0fe4450407ad927392cb (diff)
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.
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile12
1 files changed, 8 insertions, 4 deletions
diff --git a/Dockerfile b/Dockerfile
index 6346a940..f8de6b54 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,15 +2,19 @@ FROM gradle:alpine
MAINTAINER Fabian Mastenbroek <f.s.mastenbroek@student.tudelft.nl>
# 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