Spaces:
Paused
Paused
FROM python:3.9 | |
RUN apt update && \ | |
apt install -y bash \ | |
poppler-utils \ | |
tesseract-ocr \ | |
libtesseract-dev \ | |
build-essential \ | |
git \ | |
curl \ | |
ca-certificates \ | |
python3 \ | |
python3-pip && \ | |
libglib2.0-0 \ | |
libnss3 \ | |
libgconf-2-4 \ | |
libfontconfig1 \ | |
chromium-browser \ | |
chromium-chromedriver | |
rm -rf /var/lib/apt/lists | |
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 libnss -y | |
WORKDIR /code | |
COPY ./requirements.txt /code/requirements.txt | |
# Set up a new user named "user" with user ID 1000 | |
RUN useradd -m -u 1000 user | |
# Switch to the "user" user | |
USER user | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
RUN [ "python", "-c", "import nltk; nltk.download('punkt')" ] | |
# Set home to the user's home directory | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the working directory to the user's home directory | |
WORKDIR $HOME/app | |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
COPY --chown=user . $HOME/app | |
COPY . . | |
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"] |