diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..16abb03f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM maven:3.5-jdk-8-alpine as build +WORKDIR /app +COPY ./ /app +RUN mvn install -q && \ + mvn package -q && \ + ls /app/target/ && \ + MVN_VERSION=$(mvn -q \ + -Dexec.executable="echo" \ + -Dexec.args='${project.version}' \ + --non-recursive \ + org.codehaus.mojo:exec-maven-plugin:1.6.0:exec) && \ + mv /app/target/openapi-diff-${MVN_VERSION}-jar-with-dependencies.jar /app/openapi-diff.jar + +FROM openjdk:8-jre-alpine +WORKDIR /app +COPY --from=0 /app/openapi-diff.jar /app +ENTRYPOINT ["java", "-jar", "/app/openapi-diff.jar"] +CMD ["--help"] diff --git a/README.md b/README.md index 9c6589f68..0a1e69a73 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,24 @@ try { Changed response : [200] //successful operation ``` +# Docker + +## Build image +```bash +docker build -t openapi-diff . +``` + +## Run an instance + +In this example the `$(pwd)/src/test/resources` directory is mounted in the `/specs` directory of the container +in readonly mode (`ro`). + +```bash +docker run -t \ + -v $(pwd)/src/test/resources:/specs:ro \ + openapi-diff /specs/path_1.yaml /specs/path_2.yaml +``` + # License openapi-diff is released under the Apache License 2.0. diff --git a/pom.xml b/pom.xml index d77f6ba1b..a71007824 100644 --- a/pom.xml +++ b/pom.xml @@ -216,6 +216,15 @@ jar-with-dependencies + + + make-assembly + package + + single + + +