finance-bot / Dockerfile
tosanoob's picture
feat: update Dockerfile
acb1704
FROM python:3.12-slim
WORKDIR /app
# Cài đặt các gói phụ thuộc hệ thống cần thiết
# Bao gồm các gói cho weasyprint (Cairo, Pango) và dependencies khác
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libcairo2-dev \
libpango1.0-dev \
libgdk-pixbuf2.0-dev \
libffi-dev \
fontconfig \
fonts-liberation \
libharfbuzz-dev \
libfreetype-dev \
libjpeg-dev \
libpng-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements trước để tận dụng caching của Docker
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy toàn bộ code vào container
COPY . .
# Tạo thư mục static nếu chưa tồn tại
RUN mkdir -p static
# Cấp quyền truy cập
RUN chmod -R 755 .
# Thiết lập biến môi trường
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Mở cổng cho Streamlit
EXPOSE 8501
# Kiểm tra sức khỏe của ứng dụng
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
# Khởi chạy ứng dụng Streamlit
ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.address=0.0.0.0"]