Tonic commited on
Commit
a1c2725
·
unverified ·
1 Parent(s): b11641c

using docker initial commit

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