FROM python:3.10 # Set environment variables ENV VIRTUAL_ENV=/opt/venv ENV PATH="$VIRTUAL_ENV/bin:$PATH" # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ python3-venv \ && rm -rf /var/lib/apt/lists/* # Set up virtual environment RUN python3 -m venv $VIRTUAL_ENV # Set working directory WORKDIR /app # Copy requirements file COPY ./req.txt /app/req.txt # Activate virtual environment and install project dependencies RUN /bin/bash -c "source $VIRTUAL_ENV/bin/activate && pip install --upgrade pip && pip install --no-cache-dir -r req.txt" # Create directory within the /app directory RUN mkdir -p .haystack RUN chmod -R 777 /app # Copy application code COPY . /app # Run the application within the virtual environment CMD ["/opt/venv/bin/python", "app.py"]