diff --git a/apps/agent/deployment/ci-cd/Dockerfile b/apps/agent/deployment/ci-cd/Dockerfile index 9ef9d3580e77a24aa2a8f3d0e63c2d5e9f9bc42b..270ec5320d1b28b2c52fbe13b3bfc426986a2656 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 .