zero / Dockerfile
trinhvanhung's picture
Add fetch + static server
0d6b200
raw
history blame
834 Bytes
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 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"]