From a1d9ec876a36b74ea5f9b6c039e342840ccf3373 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 30 Jun 2025 13:46:17 -0400 Subject: [PATCH] chore(deps): Consolidate requirements for detector Docker builds Introduces `requirements.in` files for the `huggingface` and `llm_judge` detectors to streamline dependency installation. Fixes #19 Signed-off-by: Emilien Macchi --- detectors/Dockerfile.hf | 11 +++++------ detectors/Dockerfile.judge | 9 ++++----- detectors/huggingface/requirements.in | 2 ++ detectors/llm_judge/requirements.in | 2 ++ 4 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 detectors/huggingface/requirements.in create mode 100644 detectors/llm_judge/requirements.in diff --git a/detectors/Dockerfile.hf b/detectors/Dockerfile.hf index 440f988..57653fb 100644 --- a/detectors/Dockerfile.hf +++ b/detectors/Dockerfile.hf @@ -80,14 +80,13 @@ RUN if [ "$TARGETARCH" = "ppc64le" ]; then \ PREFIX=/usr/local make -C /openblas install ;\ fi -COPY ./common/requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt - -COPY ./huggingface/requirements.txt . +COPY ./common ./common +COPY ./huggingface/requirements.txt ./huggingface/requirements.txt +COPY ./huggingface/requirements.in ./huggingface/requirements.in RUN if [ "$TARGETARCH" = "ppc64le" ] || [ "$TARGETARCH" = "s390x" ]; then \ source /opt/rh/gcc-toolset-13/enable ; \ fi && \ - pip install --no-cache-dir -r requirements.txt + pip install --no-cache-dir -r ./huggingface/requirements.in RUN rm -rf /openblas && rm -rf /wheels @@ -103,4 +102,4 @@ COPY ./huggingface/detector.py /app EXPOSE 8000 CMD ["uvicorn", "app:app", "--workers", "4", "--host", "0.0.0.0", "--port", "8000", "--log-config", "/common/log_conf.yaml"] -# gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 \ No newline at end of file +# gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 diff --git a/detectors/Dockerfile.judge b/detectors/Dockerfile.judge index 760ca86..fe7112b 100644 --- a/detectors/Dockerfile.judge +++ b/detectors/Dockerfile.judge @@ -7,11 +7,10 @@ RUN microdnf update -y && \ FROM base as builder -COPY ./common/requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt - -COPY ./llm_judge/requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +COPY ./common ./common +COPY ./llm_judge/requirements.txt ./llm_judge/requirements.txt +COPY ./llm_judge/requirements.in ./llm_judge/requirements.in +RUN pip install --no-cache-dir -r ./llm_judge/requirements.in FROM builder diff --git a/detectors/huggingface/requirements.in b/detectors/huggingface/requirements.in new file mode 100644 index 0000000..3d5b85d --- /dev/null +++ b/detectors/huggingface/requirements.in @@ -0,0 +1,2 @@ +-r ../common/requirements.txt +-r ./requirements.txt \ No newline at end of file diff --git a/detectors/llm_judge/requirements.in b/detectors/llm_judge/requirements.in new file mode 100644 index 0000000..3d5b85d --- /dev/null +++ b/detectors/llm_judge/requirements.in @@ -0,0 +1,2 @@ +-r ../common/requirements.txt +-r ./requirements.txt \ No newline at end of file