Skip to content

Commit

Permalink
Added nonroot user access in dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Sheetal-ayanworks <sheetal.shevalkar@ayanworks.com>
  • Loading branch information
Sheetal-ayanworks committed Feb 10, 2024
1 parent a90a40e commit a635b1d
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Dockerfiles/Dockerfile.agent-provisioning
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Stage 1: Build the application
FROM node:18-alpine as build
# RUN npm install -g pnpm
# Install AWS CLI
# RUN apk update
# RUN apk add openssh-client
# RUN apk update
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot


# RUN apk add aws-cli
RUN npm install -g pnpm --ignore-scripts \
&& apk update \
Expand Down Expand Up @@ -32,10 +34,10 @@ RUN pnpm run build agent-provisioning

# Stage 2: Create the final image
FROM node:18-alpine as prod
# Install AWS CLI
# RUN apk update
# RUN apk add openssh-client
# RUN apk update
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
# RUN apk add aws-cli
RUN npm install -g pnpm --ignore-scripts \
&& apk update \
Expand Down
10 changes: 10 additions & 0 deletions Dockerfiles/Dockerfile.agent-service
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Stage 1: Build the application
FROM node:18-alpine as build

RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand All @@ -19,6 +24,11 @@ RUN pnpm run build agent-service

# Stage 2: Create the final image
FROM node:18-alpine

RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.api-gateway
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand All @@ -20,6 +24,10 @@ RUN pnpm run build api-gateway

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.connection
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app
Expand All @@ -20,6 +24,10 @@ RUN pnpm run build connection

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.ecosystem
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand All @@ -20,6 +24,10 @@ RUN pnpm run build ecosystem

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.issuance
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand All @@ -20,6 +24,10 @@ RUN pnpm run build issuance

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.ledger
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand All @@ -21,6 +25,10 @@ RUN npm run build ledger

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.organization
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand All @@ -20,6 +24,10 @@ RUN pnpm run build organization

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.user
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-slim as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm

# We don't need the standalone Chromium
Expand Down Expand Up @@ -33,6 +37,10 @@ RUN pnpm run build user

# Stage 2: Create the final image
FROM node:18-slim
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.utility
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-slim as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm

# We don't need the standalone Chromium
Expand Down Expand Up @@ -33,6 +37,10 @@ RUN pnpm run build utility

# Stage 2: Create the final image
FROM node:18-slim
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.verification
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app
Expand All @@ -19,6 +23,10 @@ RUN npm run build verification

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app
Expand Down
8 changes: 8 additions & 0 deletions Dockerfiles/Dockerfile.webhook
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app
Expand All @@ -20,6 +24,10 @@ RUN pnpm run build webhook

# Stage 2: Create the final image
FROM node:18-alpine
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app
Expand Down

0 comments on commit a635b1d

Please sign in to comment.