NOT-OMEGA commited on
Commit
9e4f2f4
Β·
verified Β·
1 Parent(s): 82c1ae7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -16
Dockerfile CHANGED
@@ -6,16 +6,12 @@
6
 
7
  FROM ubuntu:22.04
8
 
9
- # Avoid interactive prompts
10
  ENV DEBIAN_FRONTEND=noninteractive
11
  ENV PYTHONUNBUFFERED=1
12
  ENV HF_REPO_ID=NOT-OMEGA/NanoMind
13
-
14
- # Speed Mode defaults (1 engine, 2 OMP threads β†’ max single-user throughput)
15
  ENV N_ENGINES=1
16
  ENV OMP_NUM_THREADS=2
17
 
18
- # ── System deps ──────────────────────────────────────────────
19
  RUN apt-get update && apt-get install -y \
20
  python3.11 \
21
  python3-pip \
@@ -27,35 +23,28 @@ RUN apt-get update && apt-get install -y \
27
  RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
28
  ln -sf /usr/bin/python3 /usr/bin/python
29
 
30
- # ── App directory ─────────────────────────────────────────────
31
  WORKDIR /app
32
 
33
- # ── Python deps ──────────────────────────────────────────────
34
  COPY requirements.txt .
35
  RUN pip install --no-cache-dir -r requirements.txt
36
 
37
- # ── Copy source files ─────────────────────────────────────────
38
- COPY inference.cpp .
39
- COPY main.py .
40
- COPY index.html .
 
41
 
42
- # ── Compile C++ inference engine ──────────────────────────────
43
- # -march=native catches AVX2 on HF Space vCPUs (confirmed Haswell+)
44
- # -fopenmp links libgomp for multi-threaded attention + matmul
45
  RUN g++ -O3 -march=native -fopenmp -ffast-math -std=c++17 \
46
  -o inference inference.cpp -lm && \
47
  chmod +x inference && \
48
  echo "βœ… inference binary compiled"
49
 
50
- # ── HF Space permissions (runs as user 1000) ──────────────────
51
  RUN useradd -m -u 1000 appuser && \
52
  chown -R appuser:appuser /app
53
  USER appuser
54
 
55
- # ── Healthcheck ───────────────────────────────────────────────
56
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
57
  CMD curl -f http://localhost:7860/health || exit 1
58
 
59
- # ── Start ─────────────────────────────────────────────────────
60
  EXPOSE 7860
61
  CMD ["python", "main.py"]
 
6
 
7
  FROM ubuntu:22.04
8
 
 
9
  ENV DEBIAN_FRONTEND=noninteractive
10
  ENV PYTHONUNBUFFERED=1
11
  ENV HF_REPO_ID=NOT-OMEGA/NanoMind
 
 
12
  ENV N_ENGINES=1
13
  ENV OMP_NUM_THREADS=2
14
 
 
15
  RUN apt-get update && apt-get install -y \
16
  python3.11 \
17
  python3-pip \
 
23
  RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
24
  ln -sf /usr/bin/python3 /usr/bin/python
25
 
 
26
  WORKDIR /app
27
 
 
28
  COPY requirements.txt .
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ COPY inference.cpp .
32
+ COPY main.py .
33
+ COPY index.html .
34
+ COPY model.bin .
35
+ COPY tokenizer.bin .
36
 
 
 
 
37
  RUN g++ -O3 -march=native -fopenmp -ffast-math -std=c++17 \
38
  -o inference inference.cpp -lm && \
39
  chmod +x inference && \
40
  echo "βœ… inference binary compiled"
41
 
 
42
  RUN useradd -m -u 1000 appuser && \
43
  chown -R appuser:appuser /app
44
  USER appuser
45
 
 
46
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
47
  CMD curl -f http://localhost:7860/health || exit 1
48
 
 
49
  EXPOSE 7860
50
  CMD ["python", "main.py"]