You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: build and publish container images for easy integration (#620)
* feat: Containerfile to create image from current source
Signed-off-by: Matthias Blümel <[email protected]>
* feat: Build and publish container images for easy integration
* Run test-docker in CI with a valid IBM ruleset extension
* Add docs for container image use on README
* Add deploy step to push images
Signed-off-by: John Starich <[email protected]>
---------
Signed-off-by: Matthias Blümel <[email protected]>
Signed-off-by: John Starich <[email protected]>
Co-authored-by: Matthias Blümel <[email protected]>
LABEL org.opencontainers.image.description="The IBM OpenAPI Validator lets you validate OpenAPI 3.x documents according to the OpenAPI 3.x specification, as well as IBM-defined best practices."
7
+
8
+
WORKDIR /src
9
+
# Copy and cache dependencies first for faster local rebuilds.
@@ -105,6 +107,44 @@ _If you installed the validator using `npm install -g ibm-openapi-validator`, yo
105
107
#### Build platform-specific binaries
106
108
It is also possible to build platform specific binaries from the source code by running `npm run pkg` in the project root directory. The binaries (lint-openapi-macos, lint-openapi-linux, lint-openapi-windows.exe) will be in the project's `packages/validator/bin` directory.
107
109
110
+
### Container image
111
+
112
+
Run the validator with the container image by mounting your API definition.
113
+
114
+
If it is named `openapi.yaml` in the current directory, then run:
115
+
```bash
116
+
docker run \
117
+
--rm --tty \
118
+
--volume "$PWD:/data:ro" \
119
+
ibmdevxsdk/openapi-validator:latest \
120
+
openapi.yaml
121
+
```
122
+
123
+
You should **replace `latest` with a specific tagged version** to avoid any surprises when new releases are published.
124
+
125
+
Flag and argument syntax is the same as described in [Usage](#usage), but file paths are relative to `/data`.
126
+
127
+
To use a custom ruleset named `ruleset.yaml` in the current directory, run:
128
+
```bash
129
+
docker run \
130
+
--rm --tty \
131
+
--volume "$PWD:/data:ro" \
132
+
ibmdevxsdk/openapi-validator:latest \
133
+
--ruleset ruleset.yaml \
134
+
openapi.yaml
135
+
```
136
+
137
+
#### Building your own
138
+
139
+
If the existing image doesn't suit your needs, you could extend it and build your own.
140
+
141
+
For example, to build a validator image with your own custom ruleset package installed, make a `Dockerfile` like this:
0 commit comments