FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends git zip unzip && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt COPY . /app ENV PORT=7860 EXPOSE 7860 ENV BYPASS_TOOL_CONSENT=true ENV LOOM_DB_PATH=/data/loom.db RUN mkdir -p /data && chmod 777 /data && useradd -m -u 1000 appuser && chown -R appuser:appuser /app /data USER appuser HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health', timeout=5)" || exit 1 CMD ["python", "critique_service.py"]