ga4gh / gh-openapi-docs

Package for building OpenAPI schema docs and UI for gh-pages
Apache License 2.0
7 stars 5 forks source link

Feature/add dockerfile #89

Open jb-adams opened 2 years ago

jb-adams commented 2 years ago

Dockerfile to execute docs build in CI via docker container. Currently registered on docker hub

jb-adams commented 2 years ago

solution for #82

tschaffter commented 2 years ago

@jb-adams This is a nice way to build the to dockerize the image.

I tried to run the tool using the following command but without success. Do you see what I may doing wrong? Adding an example to the README could help.

$ docker run -it --rm -v ${PWD}:/project \
>   ga4gh/gh-openapi-docs:0.2.2-rc3 \
>     --dry-run true \
>     -c /project/.spec-docs.json.sample.2
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:1172:7)
    at constructBranchPath (webpack:///./src/lib/config.js?:40:56)
    at eval (webpack:///./src/lib/config.js?:45:15)
    at Module../src/lib/config.js (/snapshot/dist/bundle.js)
    at __webpack_require__ (/snapshot/dist/bundle.js)
    at eval (webpack:///./src/lib/tasks.js?:3:65)
    at Module../src/lib/tasks.js (/snapshot/dist/bundle.js)
    at __webpack_require__ (/snapshot/dist/bundle.js) {
  code: 'ERR_INVALID_ARG_TYPE'
}

where I replaced the content of /project/.spec-docs.json.sample.2 so that the value of apiSpecPath starts with the name of the docker volume I'm mounting (/project).

{
    "buildPages": [
        {
            "apiSpecPath": "/project/test/test-spec/combined/openapi.yaml",
            "htmlOutfile": "index.html",
            "yamlOutfile": "openapi.yaml",
            "jsonOutfile": "openapi.json"
        }
    ],
    "redocTheme": "ga4gh"
}
tschaffter commented 2 years ago

An improvement would be to run the tool as a non-root user, e.g. using gosu.

tschaffter commented 2 years ago

@jb-adams I'm having an issue running the dockerized tool (see above). Do you know what the issue may be?