Skip to content

Commit 7eb63c6

Browse files
authored
Updated vulnerable packages (#1573)
* Updated vulnerable packages and Updated all Dockerfiles to use Node.js 24 Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve Dockerfile vulnerabilities and cleanup Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve the Coderabit changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve Dockerfile vulnerabilities and cleanup Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve the sonarqube changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve the sonarqube changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve the sonarqube changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fix: Resolve the sonarqube changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fixed coderabit suggested changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Fixed coderabit suggested changes Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * All 19 Dockerfiles have been updated consistently while maintaining their specific functionality requirements. The changes make the containers more secure and reduce potential vulnerabilities that would be flagged by Trivy scans. Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * fixed agent proviosining issue Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Added stable version of openssl Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> * Added stable version of openssl Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com> --------- Signed-off-by: DeepakNemad <deepak.nemade@ayanworks.com>
1 parent 7be8107 commit 7eb63c6

21 files changed

Lines changed: 2586 additions & 2643 deletions

Dockerfiles/Dockerfile.agent-provisioning

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Stage 1: Build the application
2-
FROM node:18-alpine as build
2+
FROM node:24-alpine3.21 AS build
33
# Install OpenSSL
44
RUN apk update && apk upgrade
5-
RUN apk add --no-cache openssl
5+
RUN apk add --no-cache openssl=3.3.3-r0
66
RUN set -eux \
77
&& apk --no-cache add \
88
openssh-client \
@@ -38,10 +38,10 @@ RUN ls -R /app/apps/agent-provisioning/AFJ/
3838
RUN pnpm run build agent-provisioning
3939

4040
# Stage 2: Create the final image
41-
FROM node:18-alpine as prod
41+
FROM node:24-alpine3.21
4242
# Install OpenSSL
4343
RUN apk update && apk upgrade
44-
RUN apk add --no-cache openssl
44+
RUN apk add --no-cache openssl=3.3.3-r0
4545
RUN set -eux \
4646
&& apk --no-cache add \
4747
openssh-client \
Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,36 @@
11
# Stage 1: Build the application
2-
FROM node:18-alpine as build
3-
# Install OpenSSL
4-
RUN apk add --no-cache openssl
5-
RUN npm install -g pnpm --ignore-scripts \
6-
&& apk update \
7-
&& apk add openssh-client \
8-
&& apk add aws-cli \
9-
&& apk add docker \
10-
&& apk add docker-compose
11-
12-
RUN npm install -g pnpm
13-
# Set the working directory
2+
FROM node:24-alpine3.21 AS build
3+
RUN apk update && apk upgrade && apk add --no-cache \
4+
openssl=3.3.3-r0 \
5+
openssh-client \
6+
aws-cli \
7+
docker \
8+
docker-compose \
9+
&& rm -rf /var/cache/apk/*
10+
RUN npm install -g pnpm@9.15.3 --ignore-scripts
1411
WORKDIR /app
15-
16-
# Copy package.json and package-lock.json
17-
COPY package.json ./
18-
COPY pnpm-workspace.yaml ./
19-
12+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
2013
ENV PUPPETEER_SKIP_DOWNLOAD=true
21-
22-
# Install dependencies while ignoring scripts (including Puppeteer's installation)
23-
RUN pnpm i --ignore-scripts
24-
25-
# Copy the rest of the application code
14+
RUN pnpm i --frozen-lockfile --ignore-scripts
2615
COPY . .
27-
# RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
2816
RUN cd libs/prisma-service && npx prisma generate
29-
30-
# Build the user service
3117
RUN pnpm run build agent-service
18+
RUN pnpm prune --prod
3219

3320
# Stage 2: Create the final image
34-
FROM node:18-alpine
35-
# Install OpenSSL
36-
RUN apk add --no-cache openssl
37-
RUN npm install -g pnpm --ignore-scripts \
38-
&& apk update \
39-
&& apk add openssh-client \
40-
&& apk add aws-cli \
41-
&& apk add docker \
42-
&& apk add docker-compose
43-
44-
# RUN npm install -g pnpm
45-
# Set the working directory
21+
FROM node:24-alpine3.21
22+
RUN apk update && apk upgrade && apk add --no-cache \
23+
openssl=3.3.3-r0 \
24+
openssh-client \
25+
aws-cli \
26+
docker \
27+
docker-compose \
28+
&& rm -rf /var/cache/apk/* \
29+
&& addgroup -g 1001 -S nodejs \
30+
&& adduser -S nextjs -u 1001
4631
WORKDIR /app
47-
48-
# Copy the compiled code from the build stage
4932
COPY --from=build /app/dist/apps/agent-service/ ./dist/apps/agent-service/
50-
51-
# Copy the libs folder from the build stage
5233
COPY --from=build /app/libs/ ./libs/
53-
#COPY --from=build /app/package.json ./
54-
COPY --from=build /app/node_modules ./node_modules
55-
56-
# Set the command to run the microservice
57-
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/agent-service/main.js"]
34+
COPY --from=build /app/node_modules ./node_modules
35+
USER nextjs
36+
CMD ["node", "dist/apps/agent-service/main.js"]

Dockerfiles/Dockerfile.api-gateway

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,26 @@
11
# Stage 1: Build the application
2-
FROM node:18-alpine as build
3-
# Install OpenSSL
4-
RUN apk add --no-cache openssl
5-
RUN npm install -g pnpm
6-
# Set the working directory
2+
FROM node:24-alpine3.21 AS build
3+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
4+
&& rm -rf /var/cache/apk/*
5+
RUN npm install -g pnpm@9.15.3 --ignore-scripts
76
WORKDIR /app
8-
9-
# Copy package.json and package-lock.json
10-
COPY package.json ./
11-
COPY pnpm-workspace.yaml ./
12-
# COPY package-lock.json ./
13-
7+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
148
ENV PUPPETEER_SKIP_DOWNLOAD=true
15-
16-
# Install dependencies while ignoring scripts (including Puppeteer's installation)
17-
RUN pnpm i --ignore-scripts
18-
19-
# Copy the rest of the application code
9+
RUN pnpm i --frozen-lockfile --ignore-scripts
2010
COPY . .
21-
# RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
2211
RUN cd libs/prisma-service && npx prisma generate
23-
24-
# Build the api-gateway service
2512
RUN pnpm run build api-gateway
13+
RUN pnpm prune --prod
2614

2715
# Stage 2: Create the final image
28-
FROM node:18-alpine
29-
# Install OpenSSL
30-
RUN apk add --no-cache openssl
31-
32-
# Set the working directory
16+
FROM node:24-alpine3.21
17+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
18+
&& rm -rf /var/cache/apk/* \
19+
&& addgroup -g 1001 -S nodejs \
20+
&& adduser -S nextjs -u 1001
3321
WORKDIR /app
34-
35-
# Copy the compiled code from the build stage
3622
COPY --from=build /app/dist/apps/api-gateway/ ./dist/apps/api-gateway/
37-
38-
# Copy the libs folder from the build stage
3923
COPY --from=build /app/libs/ ./libs/
40-
COPY --from=build /app/node_modules ./node_modules
41-
# COPY --from=build /app/uploadedFiles ./uploadedFiles
42-
43-
# Set the command to run the microservice
44-
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/api-gateway/main.js"]
24+
COPY --from=build /app/node_modules ./node_modules
25+
USER nextjs
26+
CMD ["node", "dist/apps/api-gateway/main.js"]
Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,26 @@
11
# Stage 1: Build the application
2-
FROM node:18-alpine AS build
3-
# Install OpenSSL
4-
RUN apk add --no-cache openssl
5-
RUN npm install -g pnpm
6-
7-
# Set the working directory
2+
FROM node:24-alpine3.21 AS build
3+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
4+
&& rm -rf /var/cache/apk/*
5+
RUN npm install -g pnpm@9.15.3 --ignore-scripts
86
WORKDIR /app
9-
10-
# Copy package.json and package-lock.json
11-
COPY package.json ./
12-
COPY pnpm-workspace.yaml ./
13-
7+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
148
ENV PUPPETEER_SKIP_DOWNLOAD=true
15-
16-
# Install dependencies while ignoring scripts (including Puppeteer's installation)
17-
RUN pnpm i --ignore-scripts
18-
19-
# Copy the rest of the application code
9+
RUN pnpm i --frozen-lockfile --ignore-scripts
2010
COPY . .
21-
# RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
2211
RUN cd libs/prisma-service && npx prisma generate
23-
24-
# Build the user service
2512
RUN pnpm run build cloud-wallet
13+
RUN pnpm prune --prod
2614

2715
# Stage 2: Create the final image
28-
FROM node:18-alpine
29-
30-
RUN apk add --no-cache openssl
31-
32-
# Set the working directory
16+
FROM node:24-alpine3.21
17+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
18+
&& rm -rf /var/cache/apk/* \
19+
&& addgroup -g 1001 -S nodejs \
20+
&& adduser -S nextjs -u 1001
3321
WORKDIR /app
34-
# RUN npm install -g pnpm
35-
36-
# Copy the compiled code from the build stage
3722
COPY --from=build /app/dist/apps/cloud-wallet/ ./dist/apps/cloud-wallet/
38-
39-
# Copy the libs folder from the build stage
4023
COPY --from=build /app/libs/ ./libs/
41-
#COPY --from=build /app/package.json ./
42-
COPY --from=build /app/node_modules ./node_modules
43-
44-
45-
# Set the command to run the microservice
46-
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/cloud-wallet/main.js"]
24+
COPY --from=build /app/node_modules ./node_modules
25+
USER nextjs
26+
CMD ["node", "dist/apps/cloud-wallet/main.js"]

Dockerfiles/Dockerfile.connection

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,26 @@
11
# Stage 1: Build the application
2-
FROM node:18-alpine as build
3-
# Install OpenSSL
4-
RUN apk add --no-cache openssl
5-
RUN npm install -g pnpm
6-
# Set the working directory
2+
FROM node:24-alpine3.21 AS build
3+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
4+
&& rm -rf /var/cache/apk/*
5+
RUN npm install -g pnpm@9.15.3 --ignore-scripts
76
WORKDIR /app
8-
9-
# Copy package.json and package-lock.json
10-
COPY package.json ./
11-
COPY pnpm-workspace.yaml ./
12-
#COPY package-lock.json ./
13-
7+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
148
ENV PUPPETEER_SKIP_DOWNLOAD=true
15-
16-
# Install dependencies while ignoring scripts (including Puppeteer's installation)
17-
RUN pnpm i --ignore-scripts
18-
19-
# Copy the rest of the application code
9+
RUN pnpm i --frozen-lockfile --ignore-scripts
2010
COPY . .
21-
# RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
2211
RUN cd libs/prisma-service && npx prisma generate
23-
24-
# Build the connection service
2512
RUN pnpm run build connection
13+
RUN pnpm prune --prod
2614

2715
# Stage 2: Create the final image
28-
FROM node:18-alpine
29-
# Install OpenSSL
30-
RUN apk add --no-cache openssl
31-
# RUN npm install -g pnpm
32-
# Set the working directory
16+
FROM node:24-alpine3.21
17+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
18+
&& rm -rf /var/cache/apk/* \
19+
&& addgroup -g 1001 -S nodejs \
20+
&& adduser -S nextjs -u 1001
3321
WORKDIR /app
34-
35-
# Copy the compiled code from the build stage
3622
COPY --from=build /app/dist/apps/connection/ ./dist/apps/connection/
37-
38-
# Copy the libs folder from the build stage
3923
COPY --from=build /app/libs/ ./libs/
40-
#COPY --from=build /app/package.json ./
41-
COPY --from=build /app/node_modules ./node_modules
42-
43-
# Install production dependencies for the final image
44-
#RUN npm i --only=production
45-
46-
# Set the command to run the microservice
47-
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/connection/main.js"]
24+
COPY --from=build /app/node_modules ./node_modules
25+
USER nextjs
26+
CMD ["node", "dist/apps/connection/main.js"]

Dockerfiles/Dockerfile.ecosystem

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,26 @@
11
# Stage 1: Build the application
2-
FROM node:18-alpine as build
3-
# Install OpenSSL
4-
RUN apk add --no-cache openssl
5-
RUN npm install -g pnpm
6-
# Set the working directory
2+
FROM node:24-alpine3.21 AS build
3+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
4+
&& rm -rf /var/cache/apk/*
5+
RUN npm install -g pnpm@9.15.3 --ignore-scripts
76
WORKDIR /app
8-
9-
# Copy package.json and package-lock.json
10-
COPY package.json ./
11-
COPY pnpm-workspace.yaml ./
12-
#COPY package-lock.json ./
13-
7+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
148
ENV PUPPETEER_SKIP_DOWNLOAD=true
15-
16-
# Install dependencies while ignoring scripts (including Puppeteer's installation)
17-
RUN pnpm i --ignore-scripts
18-
19-
# Copy the rest of the application code
9+
RUN pnpm i --frozen-lockfile --ignore-scripts
2010
COPY . .
21-
# RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate
2211
RUN cd libs/prisma-service && npx prisma generate
23-
24-
# Build the connection service
2512
RUN pnpm run build ecosystem
13+
RUN pnpm prune --prod
2614

2715
# Stage 2: Create the final image
28-
FROM node:18-alpine
29-
# Install OpenSSL
30-
RUN apk add --no-cache openssl
31-
# RUN npm install -g pnpm
32-
# Set the working directory
16+
FROM node:24-alpine3.21
17+
RUN apk update && apk upgrade && apk add --no-cache openssl=3.3.3-r0 \
18+
&& rm -rf /var/cache/apk/* \
19+
&& addgroup -g 1001 -S nodejs \
20+
&& adduser -S nextjs -u 1001
3321
WORKDIR /app
34-
35-
# Copy the compiled code from the build stage
3622
COPY --from=build /app/dist/apps/ecosystem/ ./dist/apps/ecosystem/
37-
38-
# Copy the libs folder from the build stage
3923
COPY --from=build /app/libs/ ./libs/
40-
#COPY --from=build /app/package.json ./
41-
COPY --from=build /app/node_modules ./node_modules
42-
43-
# Set the command to run the microservice
44-
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/ecosystem/main.js"]
24+
COPY --from=build /app/node_modules ./node_modules
25+
USER nextjs
26+
CMD ["node", "dist/apps/ecosystem/main.js"]

0 commit comments

Comments
 (0)