|
|
|
|
|
FROM python:3.10-slim |
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
build-essential \ |
|
|
curl \ |
|
|
software-properties-common \ |
|
|
git \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface |
|
|
ENV STREAMLIT_SERVER_PORT=7860 |
|
|
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 |
|
|
|
|
|
|
|
|
RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user/.cache |
|
|
|
|
|
|
|
|
USER user |
|
|
|
|
|
|
|
|
ENV HOME=/home/user \ |
|
|
PATH=/home/user/.local/bin:$PATH |
|
|
|
|
|
|
|
|
WORKDIR $HOME/app |
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir --upgrade pip |
|
|
|
|
|
|
|
|
COPY --chown=user . $HOME/app |
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
|
|
|
RUN mkdir -p content |
|
|
ADD --chown=user https://huggingface.co/datasets/manhteky123/LawVietnamese/resolve/main/data.csv content/data.csv |
|
|
ADD --chown=user https://huggingface.co/datasets/manhteky123/LawVietnamese/resolve/main/faiss_index.bin content/faiss_index.bin |
|
|
ADD --chown=user https://huggingface.co/datasets/manhteky123/LawVietnamese/resolve/main/vectors.npy content/vectors.npy |
|
|
|
|
|
|
|
|
RUN mkdir -p .streamlit |
|
|
|
|
|
|
|
|
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1 |
|
|
|
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
|
|
|
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false"] |
|
|
|