Spaces:
Runtime error
Runtime error
Upload Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Sử dụng một base image có Python
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Thiết lập môi trường
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
# Cài đặt các dependencies hệ thống tối thiểu
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
ffmpeg \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Cài đặt các thư viện Python
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Sao chép code ứng dụng
|
| 18 |
+
COPY app.py .
|
| 19 |
+
|
| 20 |
+
# Chuyển sang user không phải root để tăng bảo mật
|
| 21 |
+
RUN useradd -m appuser
|
| 22 |
+
USER appuser
|
| 23 |
+
|
| 24 |
+
# Expose port và chạy ứng dụng FastAPI
|
| 25 |
+
EXPOSE 7860
|
| 26 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|