Spaces:
Runtime error
Runtime error
File size: 3,903 Bytes
66958f4 d134bdd 9f5f808 d134bdd d069633 66958f4 d134bdd a3f2d83 d134bdd 5172af6 d134bdd c6f309a d134bdd c6f309a d134bdd 6d2e19b 30c9c1f c6f309a d134bdd 9f5f808 d134bdd 9f5f808 d134bdd 66958f4 d134bdd 9eeb306 d134bdd 9f5f808 7df7d12 d134bdd 943fe4c 1dabb71 d134bdd |
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# syntax=docker/dockerfile:1.4
# Use the official Debian 12 (Bookworm) base image
FROM debian:13
# Set environment variables to avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install system-level dependencies as root
RUN apt-get update && \
apt-get install -y \
build-essential \
curl \
ca-certificates \
git \
cmake \
clang \
pkg-config \
ccache \
wget \
vim \
libicu76 \
expect
# Create a non-root user and set up their environment
RUN useradd -m user && \
mkdir -p /home/user/code && \
chown -R user:user /home/user
# Switch to the non-root user
USER user
WORKDIR /home/user
RUN mkdir -p /home/user/code/models && \
mkdir -p /home/user/code/app/wwwroot && \
cd /home/user/code/models && \
wget -q https://huggingface.co/Mungert/Qwen3-4B-Instruct-2507-GGUF/resolve/main/Qwen3-4B-Instruct-2507-q8_0.gguf
# Clone and build OpenBLAS as the non-root user
RUN git clone https://github.com/OpenMathLib/OpenBLAS.git /home/user/code/models/OpenBLAS && \
cd /home/user/code/models/OpenBLAS && \
make -j2 > build.log 2>&1 || (tail -20 build.log && false)
# Switch to root for the OpenBLAS installation
USER root
RUN cd /home/user/code/models/OpenBLAS && \
make install > install.log 2>&1 || (tail -20 install.log && false) && \
cp /opt/OpenBLAS/lib/libopenblas* /usr/local/lib/
# Switch back to the non-root user
USER user
# Clone and build llama.cpp with OpenBLAS support as the non-root user
RUN git clone https://github.com/ggerganov/llama.cpp /home/user/code/models/llama.cpp && \
cd /home/user/code/models/llama.cpp && \
export PKG_CONFIG_PATH=/opt/OpenBLAS/lib/pkgconfig:$PKG_CONFIG_PATH && \
cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS=/home/user/code/models/OpenBLAS -DLLAMA_CURL=OFF && \
cmake --build build --config Release -j2 && \
cp /home/user/code/models/llama.cpp/build/bin/* /home/user/code/models/llama.cpp/
# Install .NET 10.0 as the non-root user
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
chmod +x dotnet-install.sh && \
./dotnet-install.sh --channel 10.0
# Set persistent environment variables
ENV DOTNET_ROOT=/home/user/.dotnet
ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
# Verify .NET installation and current user
RUN whoami && dotnet --version
# Clone repositories using the GITHUB_TOKEN secret
RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/Mungert69/NetworkMonitorLib.git /home/user/code/NetworkMonitorLib && \
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/Mungert69/NetworkMonitorLLM.git /home/user/code/NetworkMonitorLLM && \
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/Mungert69/NetworkMonitorData.git /home/user/code/NetworkMonitorData
# Copy files into the container as the non-root user
COPY --chown=user:user appsettings.json /home/user/code/app/appsettings.json
COPY --chown=user:user index.html /home/user/code/app/wwwroot/index.html
# Set the working directory for the build-qwen-3 script
WORKDIR /home/user/code/models
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Set the working directory
WORKDIR /home/user/code/NetworkMonitorLLM
# Build the .NET project as the non-root user
RUN dotnet restore && \
dotnet build -c Release
RUN cp -r /home/user/code/NetworkMonitorLLM/bin/Release/net10.0/* /home/user/code/app/ && \
rm -rf /home/user/code/NetworkMonitorLib /home/user/code/NetworkMonitorLLM /home/user/code/NetworkMonitorData
# Set the working directory to the `app` directory
WORKDIR /home/user/code/app
CMD ["dotnet", "NetworkMonitorLLM.dll", "--urls", "http://0.0.0.0:7860"]
|