andreped/ReferenceBot
0
1# Use multi-stage builds to reduce the size of the final image2FROM python:3.10-slim as builder3 4ENV PYTHONFAULTHANDLER=1 \5 PYTHONUNBUFFERED=1 \ 6 PYTHONDONTWRITEBYTECODE=1 \7 POETRY_VERSION=1.5.1 \8 PIP_NO_CACHE_DIR=19 10RUN apt-get update && apt-get install -y \11 build-essential \12 curl \13 software-properties-common \14 && rm -rf /var/lib/apt/lists/*15 16# Set up a new user named "user" with user ID 100017RUN useradd -m -u 1000 user18 19# Switch to the "user" user20USER user21 22# Set home to the user's home directory23ENV HOME=/home/user \24 PATH=/home/user/.local/bin:$PATH25 26# Set the working directory to the user's home directory27WORKDIR $HOME/app28 29COPY . $HOME/app30 31RUN python3 -m pip install -r requirements.txt32 33# Copy the current directory contents into the container at $HOME/app setting the owner to the user34COPY --chown=user . $HOME/app35 36# create data/ directory to store PDFs37RUN mkdir $HOME/app/data/ && chmod -R 777 $HOME/app/data/38 39ENV PATH="/app/.venv/bin:$PATH"40 41EXPOSE 850142 43CMD ["python", "-m", "streamlit", "run", "knowledge_gpt/main.py", "--server.port=8501", "--server.address=0.0.0.0"]44 