From afd2dfd24978d4508ca32e1f79da53d00b54c2b9 Mon Sep 17 00:00:00 2001 From: codeforkjeff Date: Wed, 24 Aug 2022 20:27:35 -0700 Subject: [PATCH] dockerize --- Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 11 ++++++++++- run_docker.sh | 3 +++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100755 run_docker.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8d53edb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ + +#### +## build container + +FROM alpine:3.16.0 as build + +WORKDIR /opt/conciliator + +RUN apk --no-cache add alpine-conf git maven openjdk8 + +COPY conciliator.iml . +COPY conciliator.properties . +COPY pom.xml . + +RUN mvn verify clean --fail-never + +COPY src src + +RUN mvn package + +#### +## application container + +FROM alpine:3.16.0 + +EXPOSE 8080 8081 + +RUN apk --no-cache add alpine-conf openjdk8-jre + +RUN setup-timezone -z America/Los_Angeles + +COPY --from=build /opt/conciliator/target/conciliator*.jar . + +CMD JARFILE=`find . -type f -name "conciliator*.jar" -print` && \ + /usr/bin/java \ + -Dcom.sun.management.jmxremote \ + -Dcom.sun.management.jmxremote.port=8081 \ + -Dcom.sun.management.jmxremote.local.only=false \ + -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=false \ + -XX:+HeapDumpOnOutOfMemoryError \ + -Xms256m -Xmx256m \ + -Dlogging.level.com.codefork.refine=DEBUG -jar \ + $JARFILE diff --git a/README.md b/README.md index 3c1300c..210fce3 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,16 @@ instructions. ## Running Conciliator on Your Own Computer -Install Java 1.8 or greater if you don't already have it. +Using Docker is the easiest and preferred way to build and run the application: + +``` +docker build -t conciliator . +./run_docker.sh +``` + +If you don't have Docker, you can run the application as follows: + +Install Java 8 if you don't already have it. Download the .jar file for the [latest release](https://github.com/codeforkjeff/conciliator/releases). Alternatively, diff --git a/run_docker.sh b/run_docker.sh new file mode 100755 index 0000000..c9a0a37 --- /dev/null +++ b/run_docker.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +docker run -d --restart always -p 127.0.0.1:8080:8080 -p 127.0.0.1:8081:8081 -v "$(pwd)/conciliator.log:/opt/conciliator/conciliator.log" conciliator:latest