From 31a8b137772a5242eb14db80dbc943c3dffd5fcb Mon Sep 17 00:00:00 2001 From: kyle Date: Thu, 1 Nov 2018 14:53:29 -0400 Subject: [PATCH] feature: full-spectrum runtime Docker configuration (via #4965) * reorganize docker things * Configurator WIP * implement Docker runtime config generator * add tests * update documentation * fix Markdown tables * Move Docker section * add note to README * move up `nodejs` install for more aggressive caching * drop exclusive test * fix missing `DISPLAY_OPERATION_ID` --- .dockerignore | 1 + Dockerfile | 20 +-- dist/index.html | 4 +- docker/configurator/index.js | 40 ++++++ docker/configurator/translator.js | 93 ++++++++++++ docker/configurator/variables.js | 105 ++++++++++++++ nginx.conf => docker/nginx.conf | 0 docker-run.sh => docker/run.sh | 24 +--- docs/usage/configuration.md | 155 +++++++++++++------- docs/usage/installation.md | 6 +- package.json | 2 +- test/docker/translator.js | 230 ++++++++++++++++++++++++++++++ 12 files changed, 596 insertions(+), 84 deletions(-) create mode 100755 docker/configurator/index.js create mode 100644 docker/configurator/translator.js create mode 100644 docker/configurator/variables.js rename nginx.conf => docker/nginx.conf (100%) rename docker-run.sh => docker/run.sh (64%) create mode 100644 test/docker/translator.js diff --git a/.dockerignore b/.dockerignore index 5f862d88..47c624e5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,4 @@ /src /swagger-ui-dist-package /test +/node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 426e2eb6..03381839 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ +# Looking for information on environment variables? +# We don't declare them here — take a look at our docs. +# https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md + FROM nginx:1.15-alpine +RUN apk add nodejs + LABEL maintainer="fehguy" -ENV VERSION "v2.2.10" -ENV FOLDER "swagger-ui-2.2.10" -ENV API_URL "https://petstore.swagger.io/v2/swagger.json" -ENV API_URLS "" ENV API_KEY "**None**" ENV OAUTH_CLIENT_ID "**None**" ENV OAUTH_CLIENT_SECRET "**None**" @@ -15,16 +17,16 @@ ENV OAUTH_ADDITIONAL_PARAMS "**None**" ENV SWAGGER_JSON "/app/swagger.json" ENV PORT 8080 ENV BASE_URL "" -ENV CONFIG_URL "" -COPY nginx.conf /etc/nginx/ +COPY ./docker/nginx.conf /etc/nginx/ # copy swagger files to the `/js` folder COPY ./dist/* /usr/share/nginx/html/ -COPY ./docker-run.sh /usr/share/nginx/ +COPY ./docker/run.sh /usr/share/nginx/ +COPY ./docker/configurator /usr/share/nginx/configurator -RUN chmod +x /usr/share/nginx/docker-run.sh +RUN chmod +x /usr/share/nginx/run.sh EXPOSE 8080 -CMD ["sh", "/usr/share/nginx/docker-run.sh"] +CMD ["sh", "/usr/share/nginx/run.sh"] diff --git a/dist/index.html b/dist/index.html index 145b6e17..32169e36 100644 --- a/dist/index.html +++ b/dist/index.html @@ -37,8 +37,7 @@