Spaces:
Build error
Build error
File size: 1,897 Bytes
13a1e24 d15f355 13a1e24 d15f355 2bd839a 13a1e24 9b5e004 13a1e24 ea300df b0066c9 13a1e24 b0066c9 13a1e24 b0066c9 13a1e24 b0066c9 ea300df 9b5e004 13a1e24 9b5e004 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
ARG APP_COLOR
ARG APP_NAME
FROM node:20 as chatui-builder
ARG APP_COLOR
ARG APP_NAME
WORKDIR /app
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git gettext && \
rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/huggingface/chat-ui.git
WORKDIR /app/chat-ui
COPY .env.local.template .env.local.template
RUN mkdir defaults
ADD defaults /defaults
RUN chmod -R 777 /defaults
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
--mount=type=secret,id=OPENID_CLIENT_SECRET,mode=0444 \
APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
&& APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
&& OPENID_CLIENT_ID="${OPENID_CLIENT_ID:="$(cat /defaults/OPENID_CLIENT_ID)"}" && export OPENID_CLIENT_ID \
&& MONGODB_URL=$(cat /run/secrets/MONGODB_URL) && export MONGODB_URL && \
OPENID_CLIENT_SECRET=$(cat /run/secrets/OPENID_CLIENT_SECRET) && export OPENID_CLIENT_SECRET && \
envsubst < ".env.local.template" > ".env.local" \
&& rm .env.local.template
RUN --mount=type=cache,target=/app/.npm \
npm set cache /app/.npm && \
npm ci
RUN npm install saslprep --save && npm run build
FROM node:20-slim
ARG APP_COLOR
ARG APP_NAME
ENV TZ=Asia/Kuala_Lumpur \
PORT=3000
COPY entrypoint.sh.template entrypoint.sh
RUN mkdir /app
RUN chown -R 1000:1000 /app
#RUN useradd -m -u 1000 user
# Switch to the "user" user
#USER user
#ENV HOME=/home/user \
# PATH=/home/user/.local/bin:$PATH
#RUN npm config set prefix /home/user/.local
RUN npm install -g pm2
COPY --from=chatui-builder --chown=1000 /app/chat-ui/node_modules /app/node_modules
COPY --from=chatui-builder --chown=1000 /app/chat-ui/package.json /app/package.json
COPY --from=chatui-builder --chown=1000 /app/chat-ui/build /app/build
ENTRYPOINT ["/bin/bash"]
CMD ["entrypoint.sh"] |