Skip to content

Commit

Permalink
Further de-duping of code in Dockerfile to tidy up the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyestein committed Dec 18, 2024
1 parent 418579a commit 98fa689
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
23 changes: 9 additions & 14 deletions docker/orthanc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

1 change: 1 addition & 0 deletions pixl_imaging/tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 98fa689

Please sign in to comment.