From 04b7e04d989f7fabe3adbd60543ada4a71a3ddd6 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Tue, 8 Aug 2023 14:02:39 -0400 Subject: [PATCH] run full backend docker image as node user --- backend/Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 2c249717f..c80ef18b5 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,6 +2,7 @@ FROM node:16-alpine AS build WORKDIR /app +USER node ENV npm_config_cache /home/node/.npm @@ -14,7 +15,12 @@ RUN npm run build # Production stage FROM node:16-alpine +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 + WORKDIR /app +USER node ENV npm_config_cache /home/node/.npm @@ -22,17 +28,10 @@ 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 \ CMD node healthcheck.js EXPOSE 4000 -USER node - CMD ["npm", "run", "start"]