Add docker wrapper to be able to use it as a cli tool without direct installation on the host

This commit is contained in:
Lee Elenbaas 2023-01-03 18:07:33 +02:00
parent 6fdafa59e7
commit cfe83c12d2
3 changed files with 23 additions and 1 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM node:alpine
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install && npm run release
WORKDIR /src
ENTRYPOINT [ "node", "/usr/src/app/bin/index.js" ]
CMD "--help"

View File

@ -58,6 +58,20 @@ $ openapi --help
$ openapi --input ./spec.json --output ./generated --client xhr
```
## Docker usage
* Help screen
```
docker run leeelenbaas/openapi-typescript-codegen --help
```
* Generate client for `sample.yaml` in current folder to the `client` subfolder
```
docker run -v "$PWD:/src" leeelenbaas/openapi-typescript-codegen -i sample.yaml -o client
```
Documentation
===
- [Basic usage](docs/basic-usage.md)

View File

@ -56,7 +56,8 @@
"eslint": "eslint .",
"eslint:fix": "eslint . --fix",
"prepublishOnly": "npm run clean && npm run release",
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b"
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b",
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
},
"dependencies": {
"camelcase": "^6.3.0",