From 2f7a4a3cd60b52ad7520bb2c4cd2733fc01173f8 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Sat, 4 Oct 2014 19:06:40 -0400 Subject: [PATCH] Add Dockerfile and notes to README. --- .dockerignore | 4 ++++ Dockerfile | 22 ++++++++++++++++++++++ README.md | 9 +++++++++ 3 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8cfdf4bb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +node_modules +bower_components +*.swp diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..cba45baa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +### +# swagger-ui-builder - https://github.com/wordnik/swagger-ui/ +# Container for building the swagger-ui static site +# +# Build: docker build -t swagger-ui-builder . +# Run: docker run -v $PWD/dist:/build/dist swagger-ui-builder +# +### + +FROM ubuntu:14.04 +MAINTAINER dnephin@gmail.com + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get install -y git npm nodejs openjdk-7-jre +RUN ln -s /usr/bin/nodejs /usr/local/bin/node + +WORKDIR /build +ADD package.json /build/package.json +RUN npm install +ADD . /build +CMD PATH=$PATH:node_modules/.bin cake dist diff --git a/README.md b/README.md index be9eff2f..f38fb760 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,15 @@ You can rebuild swagger-ui on your own to tweak it or just so you can say you di 4. npm run-script build 5. You should see the distribution under the dist folder. Open ./dist/index.html to launch Swagger UI in a browser +### Build using Docker + +To build swagger-ui using a docker container: + +``` +docker build -t swagger-ui-builder . +docker run -v $PWD/dist:/build/dist swagger-ui-builder +``` + ### Use Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.wordnik.com/api/api-docs) service and show its APIs. You can enter your own server url and click explore to view the API.