File size: 728 Bytes
f183eab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Sử dụng một base image có Python
FROM python:3.10-slim

# Thiết lập môi trường
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app

# Cài đặt các dependencies hệ thống tối thiểu
RUN apt-get update && apt-get install -y --no-install-recommends \

    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Cài đặt các thư viện Python
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Sao chép code ứng dụng
COPY app.py .

# Chuyển sang user không phải root để tăng bảo mật
RUN useradd -m appuser
USER appuser

# Expose port và chạy ứng dụng FastAPI
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]