FROM python:3.11-slim-bookworm WORKDIR /app/kronos ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PORT=7860 \ FLASK_DEBUG=false \ OPEN_BROWSER=false \ PYTHONPATH=/app/kronos ARG INSTALL_TORCH=false RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ libgomp1 \ && rm -rf /var/lib/apt/lists/* COPY requirements-docker.txt /tmp/requirements-docker.txt RUN python -m pip install --upgrade pip setuptools wheel \ && pip install --no-cache-dir --prefer-binary -r /tmp/requirements-docker.txt \ && if [ "$INSTALL_TORCH" = "true" ]; then \ pip install --no-cache-dir --prefer-binary torch --index-url https://download.pytorch.org/whl/cpu; \ else \ echo "Skip torch install. Build with --build-arg INSTALL_TORCH=true to enable CPU-only torch."; \ fi COPY . /app/kronos EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ CMD python -c "import os, urllib.request; port=os.getenv('PORT','7860'); urllib.request.urlopen('http://127.0.0.1:%s/' % port, timeout=3).read(1)" || exit 1 CMD ["python", "webui/app.py"]