feat(ebook-search): add containerized test environment
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 26s
build_systems / build-brain (pull_request) Successful in 45s
build_systems / build-bob (pull_request) Successful in 45s
build_systems / build-rhapsody-in-green (pull_request) Successful in 57s
build_systems / build-jeeves (pull_request) Successful in 2m17s
test ebook search / test-ebook-search (pull_request) Failing after 4s
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 26s
build_systems / build-brain (pull_request) Successful in 45s
build_systems / build-bob (pull_request) Successful in 45s
build_systems / build-rhapsody-in-green (pull_request) Successful in 57s
build_systems / build-jeeves (pull_request) Successful in 2m17s
test ebook search / test-ebook-search (pull_request) Failing after 4s
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
FROM python:3.14-slim
|
||||
FROM python:3.14-slim AS base
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.11.26 /uv /uvx /bin/
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
APP_DIR=/home/richie/dotfiles \
|
||||
EBOOK_SEARCH_HOST=0.0.0.0 \
|
||||
EBOOK_SEARCH_PORT=8070 \
|
||||
EBOOK_SEARCH_BM25_INDEX_DIR=/data/bm25
|
||||
UV_PROJECT_ENVIRONMENT=/opt/venv \
|
||||
UV_PYTHON_DOWNLOADS=never \
|
||||
UV_NO_CACHE=1
|
||||
|
||||
# Separate ENV instruction so ${APP_DIR} and ${PATH} from above resolve.
|
||||
ENV PYTHONPATH=${APP_DIR} \
|
||||
PATH=/opt/venv/bin:${PATH}
|
||||
|
||||
WORKDIR ${APP_DIR}
|
||||
|
||||
@@ -14,29 +19,29 @@ RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends build-essential curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY pyproject.toml README.md LICENSE ./
|
||||
COPY python ./python
|
||||
COPY python/ebook_search/docker/pyproject.toml python/ebook_search/docker/uv.lock ./
|
||||
|
||||
RUN python -m pip install --upgrade pip \
|
||||
&& python -m pip install \
|
||||
"alembic" \
|
||||
"beautifulsoup4" \
|
||||
"bm25s" \
|
||||
"ebooklib" \
|
||||
"fastapi" \
|
||||
"httpx" \
|
||||
"jinja2" \
|
||||
"pgvector" \
|
||||
"psycopg[binary]" \
|
||||
"pydantic" \
|
||||
"pydantic-settings" \
|
||||
"python-multipart" \
|
||||
"sqlalchemy" \
|
||||
"tiktoken" \
|
||||
"typer" \
|
||||
"uvicorn[standard]" \
|
||||
"yake" \
|
||||
&& python -m pip install --no-deps --editable "${APP_DIR}"
|
||||
RUN uv sync --locked --no-dev
|
||||
|
||||
|
||||
FROM base AS test
|
||||
|
||||
RUN uv sync --locked
|
||||
|
||||
COPY python ./python
|
||||
COPY tests/__init__.py ./tests/__init__.py
|
||||
COPY tests/ebook_search ./tests/ebook_search
|
||||
|
||||
CMD ["pytest"]
|
||||
|
||||
|
||||
FROM base AS runtime
|
||||
|
||||
ENV EBOOK_SEARCH_HOST=0.0.0.0 \
|
||||
EBOOK_SEARCH_PORT=8070 \
|
||||
EBOOK_SEARCH_BM25_INDEX_DIR=/data/bm25
|
||||
|
||||
COPY python ./python
|
||||
|
||||
RUN useradd --create-home --uid 10001 app \
|
||||
&& mkdir -p /data \
|
||||
|
||||
Reference in New Issue
Block a user