From 98fa6896fb33bf6090fb5b9c2309dbe64ce331bd Mon Sep 17 00:00:00 2001 From: Jeremy Stein Date: Wed, 18 Dec 2024 17:59:54 +0000 Subject: [PATCH] Further de-duping of code in Dockerfile to tidy up the merge --- docker-compose.yml | 2 ++ docker/orthanc/Dockerfile | 23 +++++++++-------------- pixl_imaging/tests/docker-compose.yml | 1 + 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 996853e2..49607200 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -107,6 +107,7 @@ services: target: pixl_orthanc_anon args: <<: *build-args-common + ORTHANC_DIR: orthanc-anon ORTHANC_CONCURRENT_JOBS: ${ORTHANC_CONCURRENT_JOBS} platform: linux/amd64 command: /run/secrets @@ -177,6 +178,7 @@ services: target: pixl_orthanc_raw args: <<: *build-args-common + ORTHANC_DIR: orthanc-raw ORTHANC_RAW_MAXIMUM_STORAGE_SIZE: ${ORTHANC_RAW_MAXIMUM_STORAGE_SIZE} ORTHANC_RAW_JOB_HISTORY_SIZE: ${ORTHANC_RAW_JOB_HISTORY_SIZE} ORTHANC_CONCURRENT_JOBS: ${ORTHANC_CONCURRENT_JOBS} diff --git a/docker/orthanc/Dockerfile b/docker/orthanc/Dockerfile index a7850342..81602a90 100644 --- a/docker/orthanc/Dockerfile +++ b/docker/orthanc/Dockerfile @@ -40,33 +40,28 @@ COPY ./pixl_dcmd/ /pixl_dcmd RUN --mount=type=cache,target=/root/.cache \ /.venv/bin/pip install --no-cache-dir --force-reinstall --no-deps ./pixl_dcmd -FROM pixl_orthanc_base AS pixl_orthanc_raw +ARG ORTHANC_DIR +COPY ./orthanc/${ORTHANC_DIR}/plugin/pixl.py /etc/orthanc/pixl.py +COPY ./orthanc/${ORTHANC_DIR}/config /run/secrets -COPY ./orthanc/orthanc-raw/plugin/pixl.py /etc/orthanc/pixl.py +ENV PYTHONPATH=/.venv/lib64/python3.11/site-packages/ # Orthanc can't substitute environment veriables as integers so copy and replace before running +ARG ORTHANC_CONCURRENT_JOBS +RUN sed -i "s/\${ORTHANC_CONCURRENT_JOBS}/${ORTHANC_CONCURRENT_JOBS:-5}/g" /run/secrets/orthanc.json + +FROM pixl_orthanc_base AS pixl_orthanc_raw + ARG ORTHANC_RAW_MAXIMUM_STORAGE_SIZE ARG ORTHANC_RAW_JOB_HISTORY_SIZE -ARG ORTHANC_CONCURRENT_JOBS ARG PIXL_DICOM_TRANSFER_TIMEOUT -COPY ./orthanc/orthanc-raw/config /run/secrets RUN sed -i "s/\${ORTHANC_RAW_MAXIMUM_STORAGE_SIZE}/${ORTHANC_RAW_MAXIMUM_STORAGE_SIZE:-0}/g" /run/secrets/orthanc.json RUN sed -i "s/\${ORTHANC_RAW_JOB_HISTORY_SIZE}/${ORTHANC_RAW_JOB_HISTORY_SIZE:-100}/g" /run/secrets/orthanc.json -RUN sed -i "s/\${ORTHANC_CONCURRENT_JOBS}/${ORTHANC_CONCURRENT_JOBS:-5}/g" /run/secrets/orthanc.json RUN sed -i "s/\${ORTHANC_RAW_STABLE_SECONDS}/${PIXL_DICOM_TRANSFER_TIMEOUT:-600}/g" /run/secrets/orthanc.json -ENV PYTHONPATH=/.venv/lib64/python3.11/site-packages/ - FROM pixl_orthanc_base AS pixl_orthanc_anon -COPY ./orthanc/orthanc-anon/plugin/pixl.py /etc/orthanc/pixl.py -ENV PYTHONPATH=/.venv/lib64/python3.11/site-packages/ COPY ./orthanc/orthanc-anon/plugin/download_dicom_spec.py /etc/orthanc/download_dicom_spec.py RUN --mount=type=cache,target=/root/.cache \ python3 /etc/orthanc/download_dicom_spec.py -ARG ORTHANC_CONCURRENT_JOBS -COPY ./orthanc/orthanc-anon/config /run/secrets - -RUN sed -i "s/\${ORTHANC_CONCURRENT_JOBS}/${ORTHANC_CONCURRENT_JOBS:-5}/g" /run/secrets/orthanc.json - diff --git a/pixl_imaging/tests/docker-compose.yml b/pixl_imaging/tests/docker-compose.yml index 3aded6e0..a72c8b86 100644 --- a/pixl_imaging/tests/docker-compose.yml +++ b/pixl_imaging/tests/docker-compose.yml @@ -72,6 +72,7 @@ services: target: pixl_orthanc_raw args: PIXL_DICOM_TRANSFER_TIMEOUT: 30 + ORTHANC_DIR: orthanc-raw environment: ORTHANC_NAME: "PIXL: Raw" ORTHANC_USERNAME: "orthanc"