From 7f8bf52670950e28c53f76f757cf0b091ee16c3a Mon Sep 17 00:00:00 2001 From: "Scheidt, Fabian" Date: Mon, 5 Aug 2024 17:44:59 +0200 Subject: [PATCH] feat: use distroless base image --- .dockerignore | 3 +++ Dockerfile | 12 +++++++++--- package.json | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9f5cbce --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +# compiled output +/dist +/node_modules diff --git a/Dockerfile b/Dockerfile index 0825a11..655ea74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,16 @@ -FROM node:18 - +FROM node:20 AS build-env WORKDIR /app/ COPY package.json yarn.lock /app/ RUN yarn install COPY ./ /app/ +RUN yarn build + +FROM gcr.io/distroless/nodejs20-debian11 +WORKDIR /app/ + +COPY --from=build-env /app/node_modules /app/node_modules +COPY --from=build-env /app/dist /app/dist -CMD ["yarn", "start"] +CMD ["./dist/main.js"] diff --git a/package.json b/package.json index cc18663..b870c36 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@fabianscheidt/did-document-solution", "description": "Signs DID documents, stores them and makes them available through did:web.", - "version": "1.3.0", + "version": "1.4.0", "main": "index.ts", "license": "MIT", "scripts": {