FROM python:3.10.13-slim # Đặt thư mục làm việc WORKDIR /app # Cài đặt các thư viện hệ thống cần thiết RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg libsm6 libxext6 \ && rm -rf /var/lib/apt/lists/* # Cài đặt các gói Python trực tiếp RUN pip install absl-py==2.1.0 \ tensorflow==2.10.0 \ aiofiles==23.2.1 \ altair==4.2.2 \ annotated-types==0.7.0 \ anyio==4.6.2.post1 \ astunparse==1.6.3 \ attrs==24.2.0 \ blinker==1.9.0 \ cachetools==5.5.0 \ certifi==2024.8.30 \ charset-normalizer==3.4.0 \ click==8.1.7 \ colorama==0.4.6 \ entrypoints==0.4 \ exceptiongroup==1.2.2 \ fastapi==0.115.5 \ ffmpy==0.4.0 \ filelock==3.16.1 \ flatbuffers==24.3.25 \ fsspec==2024.10.0 \ gast==0.4.0 \ gitdb==4.0.11 \ GitPython==3.1.43 \ google-auth==2.36.0 \ google-auth-oauthlib==0.4.6 \ google-pasta==0.2.0 \ gradio==5.7.1 \ gradio_client==1.5.0 \ grpcio==1.68.0 \ h11==0.14.0 \ h5py==3.12.1 \ httpcore==1.0.7 \ httpx==0.28.0 \ huggingface-hub==0.26.3 \ idna==3.10 \ importlib_metadata==8.5.0 \ Jinja2==3.1.4 \ joblib==1.4.2 \ jsonschema==4.23.0 \ jsonschema-specifications==2024.10.1 \ keras==2.10.0 \ Keras-Preprocessing==1.1.2 \ libclang==18.1.1 \ Markdown==3.7 \ markdown-it-py==3.0.0 \ MarkupSafe==2.1.5 \ mdurl==0.1.2 \ ml-dtypes==0.4.1 \ namex==0.0.8 \ narwhals==1.14.3 \ numpy==1.26.4 \ oauthlib==3.2.2 \ opt_einsum==3.4.0 \ optree==0.13.1 \ orjson==3.10.12 \ packaging==24.2 \ pandas==2.2.3 \ pillow==11.0.0 \ pip==24.2 \ protobuf==3.19.6 \ pyarrow==18.1.0 \ pyasn1==0.6.1 \ pyasn1_modules==0.4.1 \ pydantic==2.10.2 \ pydantic_core==2.27.1 \ pydeck==0.9.1 \ pydub==0.25.1 # Thêm user không phải root để chạy ứng dụng an toàn hơn RUN useradd -m -u 1000 user USER user ENV HOME /home/user ENV PATH $HOME/.local/bin:$PATH # Thiết lập thư mục làm việc cho user WORKDIR $HOME/app COPY . $HOME/app # Expose port và chạy ứng dụng EXPOSE 7860 CMD streamlit run app.py \ --server.headless true \ --server.port 7860 \ --server.enableCORS false \ --server.enableXsrfProtection false \ --server.fileWatcherType none