diff --git a/README.md b/README.md index 35fcb6db28..6ddc263778 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,35 @@ Alternatively it can be installed from [Chocolatey](https://chocolatey.org/) by Nightlies are available via MyGet: [![AutoRest MyGet](https://img.shields.io/myget/autorest/vpre/autorest.svg?style=flat-square)](https://www.myget.org/gallery/autorest) -AutoRest can be run on OSX and Unix using Mono or by running Docker container: - - docker pull azuresdk/autorest:latest +AutoRest can be run on macOS and *nix using [Mono](http://www.mono-project.com/download): + + # Download & Unpack Autorest + curl -LO https://github.com/Azure/autorest/releases/download/AutoRest-0.16.0/autorest.0.16.0.zip && \ + unzip autorest.0.16.0.zip -d autorest/ && \ + cd autorest && \ + + # Download Swagger.json example + curl -O https://raw.githubusercontent.com/Azure/autorest/master/Samples/petstore/petstore.json && \ + + # Run AutoRest using mono + mono AutoRest.exe \ + -CodeGenerator CSharp \ + -Input petstore.json \ + -OutputDirectory CSharp_PetStore -Namespace PetStore + +Or [Docker](https://docs.docker.com/engine/installation): + + # Download Swagger.json example + curl -O https://raw.githubusercontent.com/Azure/autorest/master/Samples/petstore/petstore.json + + # Download latest AutoRest Docker image + docker pull azuresdk/autorest:latest + + # Run AutoRest using Docker, mounting the current folder (pwd) into /home inside the container + docker run -it --rm -v $(pwd):/home azuresdk/autorest:latest autorest \ + -CodeGenerator CSharp \ + -Input /home/petstore.json \ + -OutputDirectory /home/CSharp_PetStore -Namespace PetStore ## Building AutoRest AutoRest is developed primarily in C# but generates code for multiple languages. See [this link](docs/developer/guide/building-code.md) to build and test AutoRest. diff --git a/Tools/dockerfiles/Dockerfile b/Tools/dockerfiles/Dockerfile index a7b6782469..6bad5364f3 100644 --- a/Tools/dockerfiles/Dockerfile +++ b/Tools/dockerfiles/Dockerfile @@ -1,20 +1,20 @@ FROM mono:4.2 -# all in one RUN to produce less, smaller layers +ARG AUTOREST_VERSION=0.16.0 + +ADD autorest /opt/autorest/autorest + +# all-in-one RUN to produce smaller image with less layers RUN apt-get -qqy update && \ apt-get -qqy upgrade && \ - apt-get -qqy install wget unzip && \ + apt-get -qqy install bsdtar && \ apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -RUN bash -c "\ - mkdir /opt/autorest && \ - cd /opt/autorest && \ - wget https://github.com/Azure/autorest/releases/download/AutoRest-0.16.0/autorest.0.16.0.zip && \ - unzip autorest.0.16.0.zip" + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ -ADD autorest /opt/autorest/autorest + curl -#SL https://github.com/Azure/autorest/releases/download/AutoRest-$AUTOREST_VERSION/autorest.$AUTOREST_VERSION.zip | \ + bsdtar -xvf- -C /opt/autorest/ && \ + chmod +x /opt/autorest/autorest ENV PATH "$PATH:/opt/autorest/" -WORKDIR /opt/autorest/ \ No newline at end of file +WORKDIR /opt/autorest/ diff --git a/docs/index.html b/docs/index.html index 4195a29887..2621c9b953 100644 --- a/docs/index.html +++ b/docs/index.html @@ -41,9 +41,38 @@

Nightlies are available via MyGet: AutoRest MyGet

-

AutoRest can be run on OSX and Unix using Mono or by running Docker container:

+

AutoRest can be run on macOS and *nix using Mono:

+ +
+# Download & Unpack Autorest
+curl -LO https://github.com/Azure/autorest/releases/download/AutoRest-0.16.0/autorest.0.16.0.zip && \
+unzip autorest.0.16.0.zip -d autorest/ && \
+cd autorest && \
+
+# Download Swagger.json example
+curl -O https://raw.githubusercontent.com/Azure/autorest/master/Samples/petstore/petstore.json && \
+
+# Run AutoRest using mono
+mono AutoRest.exe \
+  -CodeGenerator CSharp \
+  -Input petstore.json \
+  -OutputDirectory CSharp_PetStore -Namespace PetStore
+
+ +

Or using Docker:

+ +
+# Download Swagger.json example
+curl -O https://raw.githubusercontent.com/Azure/autorest/master/Samples/petstore/petstore.json
+
+# Download latest AutoRest Docker image
+docker pull azuresdk/autorest:latest
 
-
docker pull azuresdk/autorest:latest
+# Run AutoRest using Docker, mounting the current folder (pwd) into /home inside the container
+docker run -it --rm -v $(pwd):/home azuresdk/autorest:latest autorest \
+  -CodeGenerator CSharp \
+  -Input /home/petstore.json \
+  -OutputDirectory /home/CSharp_PetStore -Namespace PetStore