Spaces:
Build error
Build error
limcheekin
commited on
Commit
•
9b5e004
1
Parent(s):
2bd839a
chore: added entrypoint.sh.template and updated dockerfile
Browse files- Dockerfile +7 -3
- entrypoint.sh.template +10 -0
Dockerfile
CHANGED
@@ -44,12 +44,12 @@ ARG APP_NAME
|
|
44 |
ENV TZ=Asia/Kuala_Lumpur \
|
45 |
PORT=3000
|
46 |
|
47 |
-
|
48 |
|
49 |
RUN mkdir /app
|
50 |
RUN chown -R 1000:1000 /app
|
51 |
|
52 |
-
RUN
|
53 |
|
54 |
# Switch to the "user" user
|
55 |
USER user
|
@@ -57,8 +57,12 @@ USER user
|
|
57 |
ENV HOME=/home/user \
|
58 |
PATH=/home/user/.local/bin:$PATH
|
59 |
|
|
|
|
|
|
|
60 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
|
61 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
|
62 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
|
63 |
|
64 |
-
|
|
|
|
44 |
ENV TZ=Asia/Kuala_Lumpur \
|
45 |
PORT=3000
|
46 |
|
47 |
+
COPY entrypoint.sh.template entrypoint.sh
|
48 |
|
49 |
RUN mkdir /app
|
50 |
RUN chown -R 1000:1000 /app
|
51 |
|
52 |
+
RUN useradd -m -u 1000 user
|
53 |
|
54 |
# Switch to the "user" user
|
55 |
USER user
|
|
|
57 |
ENV HOME=/home/user \
|
58 |
PATH=/home/user/.local/bin:$PATH
|
59 |
|
60 |
+
RUN npm config set prefix /home/user/.local
|
61 |
+
RUN npm install -g pm2
|
62 |
+
|
63 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
|
64 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
|
65 |
COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
|
66 |
|
67 |
+
ENTRYPOINT ["/bin/bash"]
|
68 |
+
CMD ["entrypoint.sh"]
|
entrypoint.sh.template
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Start the chat-ui process
|
4 |
+
pm2 start /app/build/index.js -i $CPU_CORES --no-daemon &
|
5 |
+
|
6 |
+
# Wait for any process to exit
|
7 |
+
wait -n
|
8 |
+
|
9 |
+
# Exit with status of process that exited first
|
10 |
+
exit $?
|