File size: 864 Bytes
0bb01dd
5bf8b9e
 
 
 
0bb01dd
5bf8b9e
 
 
0628798
26dd9b5
5bf8b9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e61f10
5bf8b9e
0d6b200
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM node:18 AS node_layer

# Build layer cho http-server
RUN npm install -g http-server

FROM python:3.11

# Tạo user không phải root (Hugging Face yêu cầu)
RUN useradd -m -u 1000 user
RUN npm install -g http-server
RUN apt-get update && apt-get install -y git telnet  wget ca-certificates && rm -rf /var/lib/apt/lists/*
USER user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app

# Cài Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy toàn bộ app và static
COPY --chown=user . /app

# Copy http-server từ node layer
COPY --from=node_layer /usr/local/bin/http-server /usr/local/bin/http-server
COPY --from=node_layer /usr/local/lib/node_modules /usr/local/lib/node_modules


# Chạy 2 tiến trình song song: fetch_data và http-server
CMD ["http-server", ".", "-p", "7860"]