From 492f6ab696f10d3c472d00b44d5dce2a385e6763 Mon Sep 17 00:00:00 2001 From: Zdravko Iliev <zdravko.iliev@vereign.com> Date: Mon, 7 Oct 2024 17:26:47 +0300 Subject: [PATCH] ci: merge build and lint steps --- apps/agent/deployment/ci-cd/Dockerfile | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/apps/agent/deployment/ci-cd/Dockerfile b/apps/agent/deployment/ci-cd/Dockerfile index 9ef9d358..270ec532 100644 --- a/apps/agent/deployment/ci-cd/Dockerfile +++ b/apps/agent/deployment/ci-cd/Dockerfile @@ -1,7 +1,7 @@ -FROM node:18.19.1 as base +FROM node:18.19.1 AS base RUN apt update -y && apt install yarn python3 make build-essential -y -FROM base as deps +FROM base AS deps WORKDIR /app COPY package.json . @@ -9,30 +9,17 @@ COPY yarn.lock . RUN yarn install --frozen-lockfile -FROM base as linter -#TODO: pass MR title and validate it -RUN apt update -y && apt install yarn python3 make build-essential -y +FROM base AS builder WORKDIR /app - COPY . . - COPY --from=deps /app/node_modules ./node_modules RUN npx nx run-many --target=lint --projects=agent --configuration=production RUN npx nx run-many --target=test --projects=agent --configuration=production +RUN npx nx run-many --target=build --projects=agent --configuration=production -FROM base as builder - -RUN apt update -y && apt install yarn python3 make build-essential -y - -WORKDIR /app -COPY . . -COPY --from=deps /app/node_modules ./node_modules - -RUN yarn nx run-many --target=build --projects=agent --configuration=production - -FROM node:18.19.1-buster-slim as production +FROM node:18.19.1-buster-slim AS production ENV NODE_ENV production @@ -40,7 +27,6 @@ RUN apt update -y && apt install yarn python3 make build-essential -y WORKDIR /app -#copy from build COPY --from=builder /app/dist . COPY --from=builder /app/dist/apps/agent/package.json . -- GitLab