Spaces:
Sleeping
Sleeping
Download Dockerfile from MrTechie/audit-automation-api: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/spaces/MrTechie/audit-automation-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/MrTechie/audit-automation-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/MrTechie/audit-automation-api/resolve/main/Dockerfile
1.9 kB
| # syntax=docker/dockerfile:1.7 | |
| # The Hugging Face Space's image. Anyone can pull a public Space's image, so it holds no engine | |
| # code: boot.py downloads the engines from the private model repo when the container starts. | |
| # The base stage matches the one in the repo's own Dockerfile. | |
| FROM ghcr.io/astral-sh/uv:0.13.4@sha256:9f130421e930bfbdc563c00740466603f8723158e90297d07957c2294640262b AS uv | |
| FROM python:3.12-slim-trixie@sha256:2259debdc6af85626058a15a7bf44ad6a68b8c98c9ae82a02cf5cdb92f096d47 AS base | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 | |
| # The bank engine imports tkinter at the top. This Python's _tkinter links libtk8.6; Debian's | |
| # python3-tk is built for Debian's own Python, not this one. | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends \ | |
| libtk8.6 poppler-utils tesseract-ocr tesseract-ocr-eng tini \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && useradd --create-home --uid 1000 user | |
| FROM base AS build | |
| COPY --from=uv /uv /usr/local/bin/uv | |
| ENV UV_COMPILE_BYTECODE=1 \ | |
| UV_LINK_MODE=copy \ | |
| UV_PYTHON_DOWNLOADS=never \ | |
| UV_PROJECT_ENVIRONMENT=/opt/venv | |
| WORKDIR /src | |
| COPY pyproject.toml uv.lock ./ | |
| RUN --mount=type=cache,target=/root/.cache/uv uv sync --locked --no-dev | |
| FROM base AS runtime | |
| COPY --from=build /opt/venv /opt/venv | |
| RUN install -d -o 1000 -g 1000 /opt/engines | |
| WORKDIR /app | |
| COPY docker/engines.py boot.py /opt/boot/ | |
| COPY engines.lock ./ | |
| COPY app ./app | |
| ENV PATH=/opt/venv/bin:$PATH \ | |
| AA_ENGINE_ROOT=/opt/engines \ | |
| AA_TESSERACT_CMD=/usr/bin/tesseract \ | |
| AA_POPPLER_PATH=/usr/bin \ | |
| AA_JOBS_ROOT=/tmp/audit-automation-jobs | |
| USER 1000 | |
| EXPOSE 7860 | |
| # boot.py execs tini, so tini stays PID 1 and reaps the tesseract and pdftoppm children of a | |
| # worker the runner kills. | |
| ENTRYPOINT ["python", "/opt/boot/boot.py", "tini", "--"] | |
| CMD ["uvicorn", "app.main:create_app", "--factory", "--host", "0.0.0.0", "--port", "7860"] | |