Skip to content

Commit

Permalink
Update docker images to use non-root user (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname authored Mar 7, 2024
1 parent eba0c78 commit 35c5388
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ FROM node:18-alpine
COPY --from=builder /app/packages/node/app.tgz /app.tgz

# Install production dependencies
RUN apk add --no-cache tini curl git && \
tar -xzvf /app.tgz --strip 1 && \
rm /app.tgz && \
yarn install --production && \
RUN apk add --no-cache tini curl git && \
apk add --no-cache python3 make g++ && \
npm install -g node-gyp

# Install the app
RUN npm i -g app.tgz

# Clean up unused deps
RUN rm /app.tgz && \
yarn cache clean && \
rm -rf /root/.npm /root/.cache

# Make the user not ROOT
USER 1000

# Set Entry point and command
ENTRYPOINT ["/sbin/tini", "--", "bin/run"]
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/lib/node_modules/@subql/node-near/bin/run"]
CMD ["-f","/app"]

0 comments on commit 35c5388

Please sign in to comment.