Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +19 -23
Dockerfile
CHANGED
|
@@ -1,47 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM ghcr.io/huggingface/chat-ui:latest AS chat-ui
|
| 2 |
|
|
|
|
| 3 |
FROM ghcr.io/huggingface/text-generation-inference:latest
|
| 4 |
|
| 5 |
ARG MODEL_NAME=NousResearch/Hermes-3-Llama-3.1-8B
|
| 6 |
ENV MODEL_NAME=${MODEL_NAME}
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
ENV TZ=Europe/Paris \
|
| 10 |
-
DEBIAN_FRONTEND=noninteractive \
|
| 11 |
-
PORT=3000
|
| 12 |
-
|
| 13 |
-
# Install Node.js
|
| 14 |
RUN apt-get update && \
|
| 15 |
-
apt-get install -y
|
| 16 |
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 17 |
-
apt-get
|
| 18 |
-
|
| 19 |
rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
-
# Create
|
| 22 |
-
RUN useradd -m -u 1000 -s /bin/bash user
|
| 23 |
-
|
| 24 |
-
# Setup directories with proper permissions
|
| 25 |
-
RUN mkdir -p /app && chown -R user:user /app
|
| 26 |
-
|
| 27 |
-
# Install npm tools as root first
|
| 28 |
-
RUN npm install -g dotenv-cli
|
| 29 |
|
| 30 |
-
# Copy chat-ui
|
| 31 |
COPY --from=chat-ui --chown=user:user /app/node_modules /app/node_modules
|
| 32 |
COPY --from=chat-ui --chown=user:user /app/package.json /app/package.json
|
| 33 |
COPY --from=chat-ui --chown=user:user /app/build /app/build
|
| 34 |
COPY --from=chat-ui --chown=user:user /app/.env /app/.env
|
| 35 |
|
| 36 |
-
#
|
| 37 |
COPY --chown=user:user .env.local /app/.env.local
|
| 38 |
COPY --chown=user:user entrypoint.sh /app/entrypoint.sh
|
| 39 |
RUN chmod +x /app/entrypoint.sh
|
| 40 |
|
| 41 |
-
#
|
| 42 |
USER user
|
| 43 |
-
ENV HOME=/home/user
|
| 44 |
-
|
| 45 |
|
| 46 |
# Entrypoint
|
| 47 |
-
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
| 1 |
+
FROM ghcr.io/huggingface/text-generation-inference:latest AS tgi
|
| 2 |
+
|
| 3 |
+
# Clone chat-ui from Hugging Face (or build separately and copy)
|
| 4 |
FROM ghcr.io/huggingface/chat-ui:latest AS chat-ui
|
| 5 |
|
| 6 |
+
# Use TGI image as base (includes libpython3.11 and CUDA runtime)
|
| 7 |
FROM ghcr.io/huggingface/text-generation-inference:latest
|
| 8 |
|
| 9 |
ARG MODEL_NAME=NousResearch/Hermes-3-Llama-3.1-8B
|
| 10 |
ENV MODEL_NAME=${MODEL_NAME}
|
| 11 |
+
ENV TZ=Europe/Paris
|
| 12 |
+
ENV PORT=3000
|
| 13 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 14 |
|
| 15 |
+
# Install Node.js & dotenv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
RUN apt-get update && \
|
| 17 |
+
apt-get install -y curl gnupg && \
|
| 18 |
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 19 |
+
apt-get install -y nodejs && \
|
| 20 |
+
npm install -g dotenv-cli && \
|
| 21 |
rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
+
# Create a non-root user
|
| 24 |
+
RUN useradd -m -u 1000 -s /bin/bash user && mkdir -p /app && chown -R user:user /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
# Copy chat-ui build
|
| 27 |
COPY --from=chat-ui --chown=user:user /app/node_modules /app/node_modules
|
| 28 |
COPY --from=chat-ui --chown=user:user /app/package.json /app/package.json
|
| 29 |
COPY --from=chat-ui --chown=user:user /app/build /app/build
|
| 30 |
COPY --from=chat-ui --chown=user:user /app/.env /app/.env
|
| 31 |
|
| 32 |
+
# Your config files
|
| 33 |
COPY --chown=user:user .env.local /app/.env.local
|
| 34 |
COPY --chown=user:user entrypoint.sh /app/entrypoint.sh
|
| 35 |
RUN chmod +x /app/entrypoint.sh
|
| 36 |
|
| 37 |
+
# Use non-root user
|
| 38 |
USER user
|
| 39 |
+
ENV HOME=/home/user
|
| 40 |
+
ENV PATH=/home/user/.local/bin:$PATH
|
| 41 |
|
| 42 |
# Entrypoint
|
| 43 |
+
ENTRYPOINT ["/app/entrypoint.sh"]
|