Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +49 -48
Dockerfile
CHANGED
|
@@ -1,59 +1,60 @@
|
|
| 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 |
USER user
|
| 34 |
|
| 35 |
ENV HOME=/home/user \
|
| 36 |
PATH=/home/user/.local/bin:$PATH
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
#
|
| 43 |
-
COPY --from=
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
COPY --chown=1000 .env.local /app/.env.local
|
| 46 |
|
| 47 |
-
# Copy entrypoint script and make it executable
|
| 48 |
COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
|
| 49 |
-
RUN chmod +x /app/entrypoint.sh
|
| 50 |
|
| 51 |
-
|
| 52 |
-
WORKDIR /app
|
| 53 |
-
|
| 54 |
-
# Update system configuration for MongoDB (vm.max_map_count)
|
| 55 |
-
# This needs to be done at runtime, not during the build, so it's moved to entrypoint.sh
|
| 56 |
-
# RUN echo "vm.max_map_count=1677720" >> /etc/sysctl.conf # Not recommended here
|
| 57 |
|
| 58 |
-
#
|
| 59 |
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
|
|
|
| 1 |
+
FROM ghcr.io/huggingface/chat-ui:latest AS base
|
| 2 |
+
|
| 3 |
+
FROM ghcr.io/huggingface/text-generation-inference:latest AS final
|
| 4 |
+
|
| 5 |
+
ARG MODEL_NAME
|
| 6 |
+
ENV MODEL_NAME=${MODEL_NAME}
|
| 7 |
+
|
| 8 |
+
ENV TZ=Europe/Paris \
|
| 9 |
+
PORT=3000
|
| 10 |
+
|
| 11 |
+
# mongo installation
|
| 12 |
+
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
|
| 13 |
+
gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
|
| 14 |
+
--dearmor
|
| 15 |
+
|
| 16 |
+
RUN echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
|
| 17 |
+
|
| 18 |
+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
| 19 |
+
mongodb-org && \
|
| 20 |
+
rm -rf /var/lib/apt/lists/*
|
| 21 |
+
|
| 22 |
+
# node installation
|
| 23 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | /bin/bash -
|
| 24 |
+
|
| 25 |
+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
| 26 |
+
nodejs && \
|
| 27 |
+
rm -rf /var/lib/apt/lists/*
|
| 28 |
+
|
| 29 |
+
# image setup
|
| 30 |
+
RUN useradd -m -u 1000 user
|
| 31 |
+
|
| 32 |
+
RUN mkdir /app
|
| 33 |
+
RUN chown -R 1000:1000 /app
|
| 34 |
+
RUN mkdir /data
|
| 35 |
+
RUN chown -R 1000:1000 /data
|
| 36 |
+
|
| 37 |
+
# Switch to the "user" user
|
| 38 |
USER user
|
| 39 |
|
| 40 |
ENV HOME=/home/user \
|
| 41 |
PATH=/home/user/.local/bin:$PATH
|
| 42 |
|
| 43 |
+
RUN npm config set prefix /home/user/.local
|
| 44 |
+
RUN npm install -g dotenv-cli
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
# copy chat-ui from base image
|
| 48 |
+
COPY --from=base --chown=1000 /app/node_modules /app/node_modules
|
| 49 |
+
COPY --from=base --chown=1000 /app/package.json /app/package.json
|
| 50 |
+
COPY --from=base --chown=1000 /app/build /app/build
|
| 51 |
+
|
| 52 |
+
COPY --from=base --chown=1000 /app/.env /app/.env
|
| 53 |
COPY --chown=1000 .env.local /app/.env.local
|
| 54 |
|
|
|
|
| 55 |
COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
|
|
|
|
| 56 |
|
| 57 |
+
RUN chmod +x /app/entrypoint.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
# entrypoint
|
| 60 |
ENTRYPOINT [ "/app/entrypoint.sh" ]
|