Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

run backend docker commands as node instead of root

Maidul Islamfc9393b77fc9
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 42bb6a263a..2c249717f8 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -3,6 +3,8 @@ FROM node:16-alpine AS build
WORKDIR /app
+ENV npm_config_cache /home/node/.npm
+
COPY package*.json ./
RUN npm ci --only-production
@@ -14,18 +16,23 @@ FROM node:16-alpine
WORKDIR /app
+ENV npm_config_cache /home/node/.npm
+
COPY package*.json ./
RUN npm ci --only-production
COPY --from=build /app .
+RUN chown -R node:node /app
RUN apk add --no-cache bash curl && curl -1sLf \
'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' | bash \
&& apk add infisical=0.8.1
-HEALTHCHECK --interval=10s --timeout=3s --start-period=10s \
+HEALTHCHECK --interval=10s --timeout=3s --start-period=10s \
CMD node healthcheck.js
EXPOSE 4000
-CMD ["npm", "run", "start"]
\ No newline at end of file
+USER node
+
+CMD ["npm", "run", "start"]