From 0c086919075a4cc07127299a2f16e340e919c3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=BCmel?= Date: Wed, 24 May 2023 23:20:09 +0200 Subject: [PATCH] Containerfile to create image from current source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Blümel --- .dockerignore | 5 +++++ Containerfile | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .dockerignore create mode 100644 Containerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..a716ac907 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +/.* +/node_modules +/appscan-config.xml +/*.md +/LICENSE diff --git a/Containerfile b/Containerfile new file mode 100644 index 000000000..b664ef0d3 --- /dev/null +++ b/Containerfile @@ -0,0 +1,19 @@ +FROM node:current-alpine3.17 AS builder + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY . ./ +RUN cd packages/validator && npm pack && mv ibm-openapi-validator-*.tgz /tmp/ibm-openapi-validator-latest.tgz + +FROM node:current-alpine3.17 + +RUN apk add --no-cache git + +COPY --from=builder /tmp/ibm-openapi-validator-latest.tgz /tmp +# not possible to install from github directly https://github.com/npm/npm/issues/2974 +RUN npm install -g /tmp/ibm-openapi-validator-latest.tgz \ + && npm cache clean --force + +WORKDIR /code +ENTRYPOINT ["lint-openapi", "--config", "/config.json", "--codeclimate"]