Merge pull request #2128 from romant/master

slimmed Docker image + usage
This commit is contained in:
Tony Tam
2016-05-07 06:32:09 -07:00
3 changed files with 34 additions and 20 deletions

View File

@@ -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;'

View File

@@ -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.

24
nginx.conf Normal file
View File

@@ -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;
}
}
}