1-58-Bit_LLM / Dockerfile
Tonic's picture
using docker initial commit
a1c2725 unverified
raw
history blame
1.34 kB
FROM ubuntu:22.04
# Set non-interactive frontend for apt
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies for LLVM script and repository
RUN apt-get update && apt-get install -y \
wget \
gnupg \
lsb-release \
&& rm -rf /var/lib/apt/lists/\*
# Add LLVM repository for Clang 18
RUN wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh 18 && \
rm llvm.sh
# Install system dependencies for bitnet.cpp and Python
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
clang-18 \
git \
python3.9 \
python3-pip \
&& rm -rf /var/lib/apt/lists/\*
# Set Clang as default compiler
ENV CC=/usr/bin/clang-18
ENV CXX=/usr/bin/clang++-18
# Create a non-root user (Hugging Face Spaces run as non-root)
RUN useradd -m -u 1000 user USER user WORKDIR /home/user/app
# Install Python dependencies
COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt
# Clone and build bitnet.cpp
RUN git clone https://github.com/microsoft/BitNet.git bitnet.cpp WORKDIR /home/user/app/bitnet.cpp RUN mkdir build && cd build && \
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 && \
make -j$(nproc)
# Copy application code
WORKDIR /home/user/app COPY app.py .
# Expose port 7860 (required for Hugging Face Spaces)
EXPOSE 7860
# Run Gradio app
CMD ["python3", "app.py"]