From 28ce61a20466ac871df9bcc84650948d12cfa9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 9 May 2024 09:45:34 +0300 Subject: [PATCH 1/2] Add base layer dockerfile for common setup Don't repeat node:18-slim --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b008a408e..41de33eca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM node:18-slim as build +FROM node:18-slim as base +FROM base as build LABEL maintainer="Orta Therox" LABEL "com.github.actions.name"="Danger JS Action" @@ -15,8 +16,7 @@ RUN yarn remove 'typescript' --dev && yarn add 'typescript' RUN yarn install --production --frozen-lockfile RUN chmod +x distribution/commands/danger.js - -FROM node:18-slim +FROM base WORKDIR /usr/src/danger ENV PATH="/usr/src/danger/node_modules/.bin:$PATH" COPY package.json ./ From d7c12e0966a5102f76e115d3172bbebdf6166201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 9 May 2024 09:46:09 +0300 Subject: [PATCH 2/2] Setup docker image labels to final image --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 41de33eca..639371f89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM node:18-slim as base -FROM base as build LABEL maintainer="Orta Therox" LABEL "com.github.actions.name"="Danger JS Action" @@ -8,6 +7,8 @@ LABEL "com.github.actions.icon"="zap" LABEL "com.github.actions.color"="blue" WORKDIR /usr/src/danger + +FROM base as build COPY package.json yarn.lock ./ RUN yarn install COPY . . @@ -17,7 +18,6 @@ RUN yarn install --production --frozen-lockfile RUN chmod +x distribution/commands/danger.js FROM base -WORKDIR /usr/src/danger ENV PATH="/usr/src/danger/node_modules/.bin:$PATH" COPY package.json ./ COPY --from=build /usr/src/danger/distribution ./dist