Spaces:
Build error
Build error
using docker initial commit
Browse files- Dockerfile +28 -32
- apt.txt +0 -1
Dockerfile
CHANGED
@@ -1,62 +1,58 @@
|
|
1 |
FROM ubuntu:22.04
|
2 |
|
3 |
# Set non-interactive frontend for apt
|
4 |
-
|
5 |
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
|
7 |
# Install dependencies for LLVM script and repository
|
8 |
-
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
-
wget \
|
11 |
-
gnupg \
|
12 |
-
lsb-release \
|
13 |
-
|
|
|
14 |
|
15 |
# Add LLVM repository for Clang 18
|
16 |
-
|
17 |
RUN wget https://apt.llvm.org/llvm.sh && \
|
18 |
-
chmod +x llvm.sh && \
|
19 |
-
./llvm.sh 18 && \
|
20 |
-
rm llvm.sh
|
21 |
|
22 |
# Install system dependencies for bitnet.cpp and Python
|
23 |
-
|
24 |
RUN apt-get update && apt-get install -y \
|
25 |
-
build-essential \
|
26 |
-
cmake \
|
27 |
-
clang-18 \
|
28 |
-
git \
|
29 |
-
python3.9 \
|
30 |
-
python3-pip \
|
31 |
-
&& rm -rf /var/lib/apt/lists
|
32 |
|
33 |
# Set Clang as default compiler
|
34 |
-
|
35 |
-
ENV CC=/usr/bin/clang-18
|
36 |
ENV CXX=/usr/bin/clang++-18
|
37 |
|
38 |
# Create a non-root user (Hugging Face Spaces run as non-root)
|
39 |
-
|
40 |
-
|
|
|
41 |
|
42 |
# Install Python dependencies
|
43 |
-
|
44 |
-
|
45 |
|
46 |
# Clone and build bitnet.cpp
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
51 |
|
52 |
# Copy application code
|
53 |
-
|
54 |
-
|
55 |
|
56 |
# Expose port 7860 (required for Hugging Face Spaces)
|
57 |
-
|
58 |
EXPOSE 7860
|
59 |
|
60 |
# Run Gradio app
|
61 |
-
|
62 |
CMD ["python3", "app.py"]
|
|
|
1 |
FROM ubuntu:22.04
|
2 |
|
3 |
# Set non-interactive frontend for apt
|
|
|
4 |
ENV DEBIAN_FRONTEND=noninteractive
|
5 |
|
6 |
# Install dependencies for LLVM script and repository
|
|
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
+
wget \
|
9 |
+
gnupg \
|
10 |
+
lsb-release \
|
11 |
+
software-properties-common \
|
12 |
+
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
# Add LLVM repository for Clang 18
|
|
|
15 |
RUN wget https://apt.llvm.org/llvm.sh && \
|
16 |
+
chmod +x llvm.sh && \
|
17 |
+
./llvm.sh 18 && \
|
18 |
+
rm llvm.sh
|
19 |
|
20 |
# Install system dependencies for bitnet.cpp and Python
|
|
|
21 |
RUN apt-get update && apt-get install -y \
|
22 |
+
build-essential \
|
23 |
+
cmake \
|
24 |
+
clang-18 \
|
25 |
+
git \
|
26 |
+
python3.9 \
|
27 |
+
python3-pip \
|
28 |
+
&& rm -rf /var/lib/apt/lists/*
|
29 |
|
30 |
# Set Clang as default compiler
|
31 |
+
ENV CC=/usr/bin/clang-18
|
|
|
32 |
ENV CXX=/usr/bin/clang++-18
|
33 |
|
34 |
# Create a non-root user (Hugging Face Spaces run as non-root)
|
35 |
+
RUN useradd -m -u 1000 user
|
36 |
+
USER user
|
37 |
+
WORKDIR /home/user/app
|
38 |
|
39 |
# Install Python dependencies
|
40 |
+
COPY requirements.txt .
|
41 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
42 |
|
43 |
# Clone and build bitnet.cpp
|
44 |
+
RUN git clone https://github.com/microsoft/BitNet.git bitnet.cpp
|
45 |
+
WORKDIR /home/user/app/bitnet.cpp
|
46 |
+
RUN mkdir build && cd build && \
|
47 |
+
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 && \
|
48 |
+
make -j$(nproc)
|
49 |
|
50 |
# Copy application code
|
51 |
+
WORKDIR /home/user/app
|
52 |
+
COPY app.py .
|
53 |
|
54 |
# Expose port 7860 (required for Hugging Face Spaces)
|
|
|
55 |
EXPOSE 7860
|
56 |
|
57 |
# Run Gradio app
|
|
|
58 |
CMD ["python3", "app.py"]
|
apt.txt
CHANGED
@@ -5,4 +5,3 @@ wget
|
|
5 |
gnupg
|
6 |
lsb-release
|
7 |
software-properties-common
|
8 |
-
add-apt-repository
|
|
|
5 |
gnupg
|
6 |
lsb-release
|
7 |
software-properties-common
|
|