Contributions
Not able to copy edited swagger API docs while running through docker
I am trying to runswagger-uiusing docker but the updatedswagger.jsonfile is not reflecting on browser. I am explaining my code below. # 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.19-alpine RUN apk --no-cache add nodejs LABEL maintainer="fehguy" ENV API_KEY "**None**" ENV SWAGGER_JSON "/app/swagger.json" ENV PORT 8080 ENV BASE_URL "" ENV SWAGGER_JSON_URL "" COPY ./docker/nginx.conf ./docker/cors.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/configurator /usr/share/nginx/configurator RUN chmod +x /usr/share/nginx/run.sh && \ chmod -R a+rw /usr/share/nginx && \ chmod -R a+rw /etc/nginx && \ chmod -R a+rw /var && \ chmod -R a+rw /var/run EXPOSE 8080 CMD ["sh", "/usr/share/nginx/run.sh"] This the docker file which I am using to run by following command. sudo docker build -t swagger-ui . sudo docker run -d -it -p 8080:8080 --name test-container-swagger swagger-ui:latest I have put my updated swagger.json file inside thedist/index.htmlfile. <script> window.onload = function() { // Begin Swagger UI call region const ui = SwaggerUIBundle({ url: "swagger.json", dom_id: '#swagger-ui', deepLinking: true, presets: [ SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], plugins: [ SwaggerUIBundle.plugins.DownloadUrl ], layout: "StandaloneLayout" }); // End Swagger UI call region window.ui = ui; }; </script> Here after building the image as per docker file thedistfolder should copy to/usr/share/nginx/html/inside docker. But when I am checking theindex.htmlfile insideusr/share/ngmix/htmlits looks like below. window.onload = function() { // Begin Swagger UI call region const ui = SwaggerUIBundle({ url: "https://petstore.swagger.io/v2/swagger.json", "dom_id": "#swagger-ui", deepLinking: true, presets: [ SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], plugins: [ SwaggerUIBundle.plugins.DownloadUrl ], layout: "StandaloneLayout", }) // End Swagger UI call region window.ui = ui; }; so here theurl: "https://petstore.swagger.io/v2/swagger.json"is not replacing for which I am getting the wrong swagger UI. Here I need after building the docker image my updatedswagger.jsonshould reflect. Please help me to resolve this issue.793Views0likes0Comments