# Use the official Python image as the base image FROM python:3.10 RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=user . $HOME/app COPY ./requirements.txt ~/app/requirements.txt # Copy the poetry files COPY pyproject.toml poetry.lock /app/ # Install poetry RUN pip install --upgrade pip RUN pip install poetry RUN pip install torch==1.11.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html # Set environment variable to create virtualenv within the project directory ENV POETRY_VIRTUALENVS_IN_PROJECT=true # Install project dependencies RUN poetry lock RUN poetry install # Copy the rest of the application code COPY . . CMD ["poetry", "run", "chainlit", "run", "app.py", "--port", "7860"]