diff --git a/Dockerfile b/Dockerfile index 6869d5a9..a0d7e953 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,12 @@ -### -# swagger-ui-builder - https://github.com/swagger-api/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 alpine:3.3 -FROM ubuntu:14.04 -MAINTAINER dnephin@gmail.com +MAINTAINER Roman Tarnavski -ENV DEBIAN_FRONTEND noninteractive +RUN apk add --update nginx -RUN apt-get update && apt-get install -y git npm nodejs openjdk-7-jre -RUN ln -s /usr/bin/nodejs /usr/local/bin/node +COPY nginx.conf /etc/nginx/ +ADD ./dist/ /usr/share/nginx/html -WORKDIR /build -ADD package.json /build/package.json -RUN npm install -ADD . /build -CMD ./node_modules/gulp/bin/gulp.js serve +EXPOSE 8080 + +CMD nginx -g 'daemon off;' \ No newline at end of file diff --git a/README.md b/README.md index df3f0cdb..3f9f1763 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,10 @@ To build swagger-ui using a docker container: ``` docker build -t swagger-ui-builder . -docker run -p 127.0.0.1:8080:8080 swagger-ui-builder +docker run -p 80:8080 swagger-ui-builder ``` -This will start Swagger UI at `http://localhost:8080`. +This will start Swagger UI at `http://localhost`. ### Use Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click explore to view the API. diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..3a4b0505 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,24 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + sendfile on; + + keepalive_timeout 65; + + server { + listen 8080; + server_name localhost; + + location / { + root html; + index index.html index.htm; + } + } +} \ No newline at end of file