rohmanahmad/oas3

By rohmanahmad

Updated almost 6 years ago

Image
0

40

#OAS3

OAS3 (Open API Spesification v3)

preview: https://app.swaggerhub.com/apis-docs/rohmanahmad/accounts/1.0.0

json example: https://petstore.swagger.io/v2/swagger.json

information

  • from image: swaggerapi/swagger-ui
  • available port: 8080

files:

  1. run.sh
    #! /bin/sh
    set -e
    BASE_URL=${BASE_URL:-/}
    NGINX_ROOT=/usr/share/nginx/html
    INDEX_FILE=$NGINX_ROOT/index.html

    node /usr/share/nginx/configurator $INDEX_FILE

    exec nginx -g 'daemon off;'
  1. main.html
    <h2>work fine</h2>
  1. documentation.conf
    worker_processes      1;

    events {
        worker_connections  1024;
    }

    http {
        include             mime.types;
        default_type        application/octet-stream;

        sendfile on;

        keepalive_timeout   65;

        gzip on;
        gzip_static on;
        gzip_disable "msie6";

        gzip_vary on;
        gzip_types text/plain text/css application/javascript;

        map $request_method $access_control_max_age {
            OPTIONS 1728000; # 20 days
        }

        server {
            listen            8080;
            server_name       localhost;
            index             index.html index.htm;

            location ~ ^/wedus/(accounts|office)$ {
            alias             /usr/share/nginx/html/;
            try_files $uri $uri/ /index.html;
            expires 1d;

            location ~* \.(?:json|yml|yaml)$ {
                expires -1;

                include cors.conf;
            }

            include cors.conf;
            }

            location / {
            root            /usr/share/nginx/html/;
            index           main.html;
            expires 1d;

            location ~* \.(?:json|yml|yaml)$ {
                expires -1;

                include cors.conf;
            }

            include cors.conf;
            }
        }
    }

environments:

volumes:

  • ./documentation.conf:/etc/nginx/nginx.conf
  • ./main.html:/usr/share/nginx/html/main.html
  • ./run.sh:/usr/share/nginx/run.sh

features:

  • (nginx) custom location and editable
  • multiple compose

running image:

  • docker run -p 9090:8080 [-e "API_URL=YOUR_JSON_URL"] -it IMAGE_ID

Docker Pull Command

docker pull rohmanahmad/oas3