huynguyen6906 commited on
Commit
5110713
·
verified ·
1 Parent(s): 9d1cdf4

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # syntax = docker/dockerfile:1.4
4
+ FROM python:3.11-slim
5
+
6
+ # Tắt buffer để thấy log realtime
7
+ ENV PYTHONUNBUFFERED=1
8
+ ENV PYTHONDONTWRITEBYTECODE=1
9
+
10
+ # Cài đặt hệ thống cần thiết (nhẹ)
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ gcc \
13
+ libglib2.0-0 \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ WORKDIR /app
17
+
18
+ # Copy requirements trước để tận dụng Docker cache
19
+ COPY requirements.txt .
20
+
21
+ # Cài packages (dùng --no-cache-dir để nhẹ hơn)
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy code
25
+ COPY server_paper_RAM_optimize.py .
26
+
27
+ # Tải dữ liệu từ Hugging Face khi build (tùy chọn, hoặc để runtime tải)
28
+ # Nếu bạn đã upload file .h5 + .bin vào Space rồi thì bỏ 2 dòng dưới
29
+ # COPY Papers_Embedbed_0-1000000.h5 .
30
+ # COPY hnsw_paper_index.bin .
31
+
32
+ # Expose port chuẩn HF Spaces
33
+ EXPOSE 7860
34
+
35
+ # Chạy bằng gunicorn (ổn định, hỗ trợ nhiều request)
36
+ CMD gunicorn --bind 0.0.0.0:7860 --workers 2 --timeout 120 server_paper:app