Skip to content

Commit

Permalink
feat: Improvement- use non root user for Web container (langgenius#8928)
Browse files Browse the repository at this point in the history
  • Loading branch information
s2oBCN authored and cuiks committed Oct 8, 2024
1 parent a10e788 commit 9b3c7d1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,27 @@ ENV TZ=UTC
RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone

# global runtime packages
RUN yarn global add pm2 \
&& yarn cache clean

WORKDIR /app/web
COPY --from=builder /app/web/public ./public
COPY --from=builder /app/web/.next/standalone ./
COPY --from=builder /app/web/.next/static ./.next/static


COPY docker/pm2.json ./pm2.json
COPY docker/entrypoint.sh ./entrypoint.sh


# global runtime packages
RUN yarn global add pm2 \
&& yarn cache clean \
&& mkdir /.pm2 \
&& chown -R 1001:0 /.pm2 /app/web \
&& chmod -R g=u /.pm2 /app/web


ARG COMMIT_SHA
ENV COMMIT_SHA=${COMMIT_SHA}

USER 1001
EXPOSE 3000
ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]

0 comments on commit 9b3c7d1

Please sign in to comment.