Spaces:
Running
Running
| # Dockerfile — AKIRA V21 FastAPI + PostgreSQL | |
| FROM python:3.11-slim | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
| LOCAL_LLM_AUTO_DOWNLOAD=true \ | |
| PGDATA=/var/lib/postgresql/data/pgdata \ | |
| PGHOST=localhost \ | |
| PGPORT=5432 \ | |
| PGDATABASE=akira \ | |
| PGUSER=akira \ | |
| PGPASSWORD=akira | |
| WORKDIR /akira | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| postgresql \ | |
| postgresql-client \ | |
| curl \ | |
| ca-certificates \ | |
| tesseract-ocr \ | |
| tesseract-ocr-por \ | |
| tesseract-ocr-eng \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN mkdir -p /akira/data /akira/data/cloud_sync && chmod 755 /akira/data | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir --prefer-binary \ | |
| numpy \ | |
| huggingface_hub \ | |
| psycopg2-binary \ | |
| fastapi \ | |
| uvicorn[standard] \ | |
| -r requirements.txt | |
| COPY scripts/init_pg.sh /usr/local/bin/init_pg.sh | |
| RUN chmod +x /usr/local/bin/init_pg.sh | |
| COPY scripts/pg_backup.sh /usr/local/bin/pg_backup.sh | |
| RUN chmod +x /usr/local/bin/pg_backup.sh | |
| COPY main.py . | |
| COPY modules/ modules/ | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| EXPOSE 7860 | |
| CMD ["/usr/local/bin/init_pg.sh"] | |