diff --git a/README.md b/README.md index f2c44ebf718..11925c8014f 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,18 @@ This is the swagger codegen project, which allows generation of client libraries Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more. +## Build and run using docker + +``` +git clone https://github.com/swagger-api/swagger-codegen + +cd swagger-codegen + +./run-in-docker.sh mvn package + +./run-in-docker.sh help + ``` + ## Compatibility The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification: diff --git a/run-in-docker.sh b/run-in-docker.sh new file mode 100644 index 00000000000..6cb09f82c1c --- /dev/null +++ b/run-in-docker.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e +cd "$(dirname $BASH_SOURCE)" + +maven_cache_repo="$HOME/.m2/repository" + +if [ "$1" = "mvn" ]; then + cmd="$1" + shift + args="$@" +else + cmd="java -jar /gen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + args="$@" +fi + +mkdir -p "$maven_cache_repo" + +set -x + +docker run -it \ + -w /gen \ + -v "${PWD}:/gen" \ + -v "${maven_cache_repo}:/root/.m2/repository" \ + maven:3-jdk-7 $cmd $args