From e3588577aca4935a0c64290c6c1c69995685f62c Mon Sep 17 00:00:00 2001 From: ssube Date: Mon, 17 Jun 2019 09:11:26 -0500 Subject: [PATCH] feat: add rules to image, doc --- Dockerfile | 10 +++++----- README.md | 9 +++++++++ docs/config-docker.yml | 7 +++++++ docs/config-tmp.yml | 9 --------- src/index.ts | 4 +++- 5 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 docs/config-docker.yml delete mode 100644 docs/config-tmp.yml diff --git a/Dockerfile b/Dockerfile index dd8f3dc..4ee8cff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ FROM node:11-stretch -COPY docs/config-stderr.yml /root/.salty-dog.yml +# copy config and rules, which change rarely +COPY docs/config-docker.yml /root/.salty-dog.yml +COPY rules /rules + +# copy package and bundle, which change often COPY package.json /salty-dog/package.json COPY out/bundle.js /salty-dog/out/bundle.js -WORKDIR /salty-dog - -ENV PATH "${PATH}:/usr/local/lib/node_modules" - ENTRYPOINT [ "node", "/salty-dog/out/bundle.js" ] \ No newline at end of file diff --git a/README.md b/README.md index 71b7985..edf9767 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Or, as an acronym, JSON **s**chema **a**nalysis, **l**inting, and **t**ransforma - [SALTY DOG](#salty-dog) - [Build](#build) - [Usage](#usage) + - [Docker](#docker) - [Validate](#validate) - [Validate File](#validate-file) - [Validate URL](#validate-url) @@ -57,6 +58,14 @@ ingress.extensions/gitlab created (dry run) ``` +### Docker + +The Docker container is published for each branch and tag, using the slug (`.` replaced with `-`, mostly). The latest +semi-stable image is `ssube/salty-dog:master`. + +Rules are located in `/rules` within the image. To add your own rules, mount them with +`-v ${HOME}/your-rules:/user-rules:ro` and include with `--rules /user-rules/rules.yml`. + ### Validate `salty-dog` can validate JSON and YAML from files and streams, and emit it to a file or stream (with logs going diff --git a/docs/config-docker.yml b/docs/config-docker.yml new file mode 100644 index 0000000..d54377e --- /dev/null +++ b/docs/config-docker.yml @@ -0,0 +1,7 @@ +data: + logger: + level: info + name: salty-dog + streams: + - level: info + path: /tmp/salty-dog.log diff --git a/docs/config-tmp.yml b/docs/config-tmp.yml deleted file mode 100644 index dcbbd29..0000000 --- a/docs/config-tmp.yml +++ /dev/null @@ -1,9 +0,0 @@ -data: - logger: - level: debug - name: salty-dog - streams: - - level: warn - stream: !stream stderr - - level: debug - path: /tmp/salty-dog-debug.log diff --git a/src/index.ts b/src/index.ts index 4bb26ef..273b4e2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,7 @@ const RULE_OPTION: Options = { type: 'array', }; -const MAIN_ARGS = usage(`Usage: $0 [options]`) +const MAIN_ARGS = usage(`Usage: salty-dog [options]`) .option(CONFIG_ARGS_NAME, { default: `.${VERSION_INFO.app.name}.yml`, group: 'Config:', @@ -35,6 +35,7 @@ const MAIN_ARGS = usage(`Usage: $0 [options]`) .option('count', { alias: ['c'], default: false, + desc: 'Exit with error count', type: 'boolean', }) .option('dest', { @@ -56,6 +57,7 @@ const MAIN_ARGS = usage(`Usage: $0 [options]`) .option('rules', { alias: ['r'], default: [], + desc: 'Rules file', type: 'array', }) .option('source', {