Skip to content

Commit ea4df07

Browse files
committed
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>
1 parent b99fa33 commit ea4df07

15 files changed

Lines changed: 33 additions & 37 deletions

Dockerfiles/Dockerfile.agent-provisioning

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
1616
COPY . .
1717
RUN cd libs/prisma-service && npx prisma generate
1818
RUN pnpm run build agent-provisioning
19+
RUN pnpm prune --prod
1920

2021
# Stage 2: Create the final image
2122
FROM node:24-alpine3.21
@@ -35,17 +36,10 @@ RUN mkdir -p ./agent-provisioning/AFJ/endpoints \
3536
&& mkdir -p ./agent-provisioning/AFJ/port-file \
3637
&& mkdir -p ./agent-provisioning/AFJ/token
3738
COPY --from=build /app/dist/apps/agent-provisioning/ ./dist/apps/agent-provisioning/
38-
COPY --from=build /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
39-
RUN npm install -g pnpm@9.15.3 --ignore-scripts \
40-
&& pnpm install --frozen-lockfile --ignore-scripts --prod \
41-
&& npm uninstall -g pnpm
39+
COPY --from=build /app/libs/ ./libs/
40+
COPY --from=build /app/node_modules ./node_modules
4241
COPY --from=build /app/apps/agent-provisioning/AFJ/scripts ./agent-provisioning/AFJ/scripts
4342
COPY --from=build /app/apps/agent-provisioning/AFJ/port-file ./agent-provisioning/AFJ/port-file
44-
COPY --from=build /app/libs/ ./libs/
45-
RUN chmod +x /app/agent-provisioning/AFJ/scripts/*.sh \
46-
&& chmod 755 /app/agent-provisioning/AFJ/endpoints \
47-
&& chmod 755 /app/agent-provisioning/AFJ/agent-config \
48-
&& chmod 755 /app/agent-provisioning/AFJ/token \
49-
&& chown -R nextjs:nodejs /app/agent-provisioning
43+
RUN chown -R nextjs:nodejs /app/agent-provisioning
5044
USER nextjs
5145
CMD ["node", "dist/apps/agent-provisioning/main.js"]

Dockerfiles/Dockerfile.agent-service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
1515
COPY . .
1616
RUN cd libs/prisma-service && npx prisma generate
1717
RUN pnpm run build agent-service
18+
RUN pnpm prune --prod
1819

1920
# Stage 2: Create the final image
2021
FROM node:24-alpine3.21

Dockerfiles/Dockerfile.api-gateway

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build api-gateway
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
@@ -19,9 +20,6 @@ RUN apk update && apk upgrade && apk add --no-cache openssl \
1920
WORKDIR /app
2021
COPY --from=build /app/dist/apps/api-gateway/ ./dist/apps/api-gateway/
2122
COPY --from=build /app/libs/ ./libs/
22-
COPY --from=build /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
23-
RUN npm install -g pnpm@9.15.3 --ignore-scripts \
24-
&& pnpm install --frozen-lockfile --ignore-scripts --prod \
25-
&& npm uninstall -g pnpm
23+
COPY --from=build /app/node_modules ./node_modules
2624
USER nextjs
2725
CMD ["node", "dist/apps/api-gateway/main.js"]

Dockerfiles/Dockerfile.ecosystem

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build ecosystem
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
1516
RUN apk update && apk upgrade && apk add --no-cache openssl \
1617
&& rm -rf /var/cache/apk/* \
1718
&& addgroup -g 1001 -S nodejs \
18-
&& adduser -S nextjs -u 1001 -G nodejs
19+
&& adduser -S nextjs -u 1001
1920
WORKDIR /app
2021
COPY --from=build /app/dist/apps/ecosystem/ ./dist/apps/ecosystem/
2122
COPY --from=build /app/libs/ ./libs/

Dockerfiles/Dockerfile.geolocation

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build geo-location
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
1516
RUN apk update && apk upgrade && apk add --no-cache openssl \
1617
&& rm -rf /var/cache/apk/* \
1718
&& addgroup -g 1001 -S nodejs \
18-
&& adduser -S nextjs -u 1001 -G nodejs
19+
&& adduser -S nextjs -u 1001
1920
WORKDIR /app
2021
COPY --from=build /app/dist/apps/geo-location/ ./dist/apps/geo-location/
2122
COPY --from=build /app/libs/ ./libs/

Dockerfiles/Dockerfile.issuance

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FROM node:24-alpine3.21
1616
RUN apk update && apk upgrade && apk add --no-cache openssl \
1717
&& rm -rf /var/cache/apk/* \
1818
&& addgroup -g 1001 -S nodejs \
19-
&& adduser -S nextjs -u 1001 -G nodejs
19+
&& adduser -S nextjs -u 1001
2020
WORKDIR /app
2121
COPY --from=build /app/dist/apps/issuance/ ./dist/apps/issuance/
2222
COPY --from=build /app/libs/ ./libs/

Dockerfiles/Dockerfile.notification

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build notification
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
@@ -19,9 +20,6 @@ RUN apk update && apk upgrade && apk add --no-cache openssl \
1920
WORKDIR /app
2021
COPY --from=build /app/dist/apps/notification/ ./dist/apps/notification/
2122
COPY --from=build /app/libs/ ./libs/
22-
COPY --from=build /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
23-
RUN npm install -g pnpm@9.15.3 --ignore-scripts \
24-
&& pnpm install --frozen-lockfile --ignore-scripts --prod \
25-
&& npm uninstall -g pnpm
23+
COPY --from=build /app/node_modules ./node_modules
2624
USER nextjs
2725
CMD ["node", "dist/apps/notification/main.js"]

Dockerfiles/Dockerfile.oid4vc-issuance

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build oid4vc-issuance
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
1516
RUN apk update && apk upgrade && apk add --no-cache openssl \
1617
&& rm -rf /var/cache/apk/* \
1718
&& addgroup -g 1001 -S nodejs \
18-
&& adduser -S nextjs -u 1001 -G nodejs
19+
&& adduser -S nextjs -u 1001
1920
WORKDIR /app
2021
COPY --from=build /app/dist/apps/oid4vc-issuance/ ./dist/apps/oid4vc-issuance/
2122
COPY --from=build /app/libs/ ./libs/

Dockerfiles/Dockerfile.oid4vc-verification

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build oid4vc-verification
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
1516
RUN apk update && apk upgrade && apk add --no-cache openssl \
1617
&& rm -rf /var/cache/apk/* \
1718
&& addgroup -g 1001 -S nodejs \
18-
&& adduser -S nextjs -u 1001 -G nodejs
19+
&& adduser -S nextjs -u 1001
1920
WORKDIR /app
20-
COPY --chown=root:nodejs --chmod=444 --from=build /app/dist/apps/oid4vc-verification/ ./dist/apps/oid4vc-verification/
21-
COPY --chown=root:nodejs --chmod=755 --from=build /app/libs/ ./libs/
22-
COPY --chown=root:nodejs --chmod=755 --from=build /app/node_modules ./node_modules
21+
COPY --from=build /app/dist/apps/oid4vc-verification/ ./dist/apps/oid4vc-verification/
22+
COPY --from=build /app/libs/ ./libs/
23+
COPY --from=build /app/node_modules ./node_modules
2324
USER nextjs
2425
CMD ["node", "dist/apps/oid4vc-verification/main.js"]

Dockerfiles/Dockerfile.organization

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ RUN pnpm i --frozen-lockfile --ignore-scripts
99
COPY . .
1010
RUN cd libs/prisma-service && npx prisma generate
1111
RUN pnpm run build organization
12+
RUN pnpm prune --prod
1213

1314
# Stage 2: Create the final image
1415
FROM node:24-alpine3.21
1516
RUN apk update && apk upgrade && apk add --no-cache openssl \
1617
&& rm -rf /var/cache/apk/* \
1718
&& addgroup -g 1001 -S nodejs \
18-
&& adduser -S nextjs -u 1001 -G nodejs
19+
&& adduser -S nextjs -u 1001
1920
WORKDIR /app
2021
COPY --from=build /app/dist/apps/organization/ ./dist/apps/organization/
2122
COPY --from=build /app/libs/ ./libs/

0 commit comments

Comments
 (0)