Skip to content

Commit

Permalink
build or download (part 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Jun 24, 2023
1 parent 6025fb8 commit 7657e82
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 53 deletions.
109 changes: 69 additions & 40 deletions docker/orthanc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
ARG BASE_IMAGE_TAG=current

FROM osimis/orthanc-builder-base:${BASE_IMAGE_TAG} as orthanc-builder-base
ARG ARG_AWS_ACCESS_KEY_ID
ARG ARG_AWS_SECRET_ACCESS_KEY
ENV AWS_ACCESS_KEY_ID=$ARG_AWS_ACCESS_KEY_ID
ENV AWS_SECRET_ACCESS_KEY=$ARG_AWS_SECRET_ACCESS_KEY
ARG PREFER_DOWNLOADS=1
ARG ENABLE_UPLOAD=0
ARG PLATFORM=linux/amd64



FROM osimis/orthanc-runner-base:${BASE_IMAGE_TAG} as orthanc-runner-base

Expand All @@ -13,7 +22,7 @@ FROM osimis/orthanc-builder-base:vcpkg-azure-${BASE_IMAGE_TAG} as build-plugin-o
FROM orthanc-builder-base as build-orthanc

ARG ORTHANC_COMMIT_ID
RUN /scripts/build-or-download.sh baseImage=$BASE_IMAGE_TAG target=orthanc commitId=$ORTHANC_COMMIT_ID preferDownloads=1 enableUploads=1
RUN /scripts/build-or-download.sh target=orthanc commitId=$ORTHANC_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD
# RUN hg clone https://hg.orthanc-server.com/orthanc/ -r $ORTHANC_COMMIT_ID /sources
# WORKDIR /build

Expand All @@ -28,31 +37,38 @@ RUN /scripts/build-or-download.sh baseImage=$BASE_IMAGE_TAG target=orthanc commi
FROM orthanc-builder-base as build-gdcm

ARG ORTHANC_GDCM_COMMIT_ID
RUN hg clone https://hg.orthanc-server.com/orthanc-gdcm/ -r $ORTHANC_GDCM_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DSTATIC_BUILD=ON /sources
RUN make -j 4
RUN /scripts/build-or-download.sh target=orthanc-gdcm commitId=$ORTHANC_GDCM_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD


# RUN hg clone https://hg.orthanc-server.com/orthanc-gdcm/ -r $ORTHANC_GDCM_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DSTATIC_BUILD=ON /sources
# RUN make -j 4

########################## Orthanc PG

FROM orthanc-builder-base as build-plugin-pg

ARG ORTHANC_PG_COMMIT_ID
RUN hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $ORTHANC_PG_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources/PostgreSQL
RUN make -j 4
RUN /scripts/build-or-download.sh target=orthanc-pg commitId=$ORTHANC_PG_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $ORTHANC_PG_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources/PostgreSQL
# RUN make -j 4
# disabled: needs a PG server # RUN /build/UnitTests

########################## Orthanc MySQL

FROM orthanc-builder-base as build-plugin-mysql

ARG ORTHANC_MYSQL_COMMIT_ID
RUN hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $ORTHANC_MYSQL_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources/MySQL
RUN make -j 4
RUN /scripts/build-or-download.sh target=orthanc-mysql commitId=$ORTHANC_MYSQL_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $ORTHANC_MYSQL_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources/MySQL
# RUN make -j 4
# disabled: needs a MySQL server # RUN /build/UnitTests

########################## Orthanc Transfers
Expand Down Expand Up @@ -112,63 +128,76 @@ RUN /build/UnitTests
FROM orthanc-builder-base as build-plugin-auth

ARG ORTHANC_AUTH_COMMIT_ID
RUN hg clone https://hg.orthanc-server.com/orthanc-authorization/ -r $ORTHANC_AUTH_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources
RUN make -j 4
RUN /build/UnitTests
RUN /scripts/build-or-download.sh target=orthanc-authorization commitId=$ORTHANC_AUTH_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://hg.orthanc-server.com/orthanc-authorization/ -r $ORTHANC_AUTH_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources
# RUN make -j 4
# RUN /build/UnitTests

########################## Orthanc Python

FROM orthanc-builder-base as build-plugin-python

ARG ORTHANC_PYTHON_COMMIT_ID
RUN hg clone https://hg.orthanc-server.com/orthanc-python/ -r $ORTHANC_PYTHON_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DPYTHON_VERSION=3.9 /sources
RUN make -j 4
# disabled: no unit tests: # RUN /build/UnitTests
RUN /scripts/build-or-download.sh target=orthanc-python commitId=$ORTHANC_PYTHON_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD


# RUN hg clone https://hg.orthanc-server.com/orthanc-python/ -r $ORTHANC_PYTHON_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DPYTHON_VERSION=3.9 /sources
# RUN make -j 4
# # disabled: no unit tests: # RUN /build/UnitTests

########################## Orthanc ODBC

FROM orthanc-builder-base as build-plugin-odbc

ARG ORTHANC_ODBC_COMMIT_ID
RUN hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $ORTHANC_ODBC_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources/Odbc
RUN make -j 4
# disabled: needs a ODBC server # RUN /build/UnitTests
RUN /scripts/build-or-download.sh target=orthanc-odbc commitId=$ORTHANC_ODBC_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $ORTHANC_ODBC_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources/Odbc
# RUN make -j 4
# # disabled: needs a ODBC server # RUN /build/UnitTests

# ########################## Orthanc Indexer

FROM orthanc-builder-base as build-plugin-indexer

ARG ORTHANC_INDEXER_COMMIT_ID
RUN hg clone https://orthanc.uclouvain.be/hg/orthanc-indexer/ -r $ORTHANC_INDEXER_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_LIBCSV=OFF /sources
RUN make -j 4
RUN /scripts/build-or-download.sh target=orthanc-indexer commitId=$ORTHANC_INDEXER_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://orthanc.uclouvain.be/hg/orthanc-indexer/ -r $ORTHANC_INDEXER_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_LIBCSV=OFF /sources
# RUN make -j 4

########################## Orthanc Neuro

FROM orthanc-builder-base as build-plugin-neuro

ARG ORTHANC_NEURO_COMMIT_ID
RUN hg clone https://orthanc.uclouvain.be/hg/orthanc-neuro/ -r $ORTHANC_NEURO_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_NIFTILIB=OFF /sources
RUN make -j 4
RUN /scripts/build-or-download.sh target=orthanc-neuro commitId=$ORTHANC_NEURO_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://orthanc.uclouvain.be/hg/orthanc-neuro/ -r $ORTHANC_NEURO_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_NIFTILIB=OFF /sources
# RUN make -j 4

########################## Orthanc TCIA

FROM orthanc-builder-base as build-plugin-tcia

ARG ORTHANC_TCIA_COMMIT_ID
RUN hg clone https://orthanc.uclouvain.be/hg/orthanc-tcia/ -r $ORTHANC_TCIA_COMMIT_ID /sources
WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_LIBCSV=OFF /sources
RUN make -j 4
RUN /scripts/build-or-download.sh target=orthanc-tcia commitId=$ORTHANC_TCIA_COMMIT_ID baseImage=$PLATFORM$BASE_IMAGE_TAG preferDownloads=$PREFER_DOWNLOADS enableUploads=$ENABLE_UPLOAD

# RUN hg clone https://orthanc.uclouvain.be/hg/orthanc-tcia/ -r $ORTHANC_TCIA_COMMIT_ID /sources
# WORKDIR /build
# RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_LIBCSV=OFF /sources
# RUN make -j 4

########################## Stone Web Viewer

Expand Down
4 changes: 1 addition & 3 deletions docker/orthanc/Dockerfile.builder-base
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,5 @@ RUN mkdir -p /sources
RUN mkdir -p /build
RUN mkdir -p /scripts

ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
COPY build-or-download.sh /scripts

COPY build-or-download.sh /scripts
136 changes: 128 additions & 8 deletions docker/orthanc/build-or-download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ upload() { # $1 file

if [[ $target == "orthanc" ]]; then

dl=$(expr $dl + $(download Orthanc))
dl=$(expr $dl + $(download libModalityWorklists.so))
dl=$(expr $dl + $(download libServeFolders.so))
dl=$(expr $dl + $(download libHousekeeper.so))
dl=$(expr $dl + $(download libConnectivityChecks.so))
dl=$(expr $dl + $(download libDelayedDeletion.so))
dl=$(expr $dl + $(download libMultitenantDicom.so))
dl=$(( $dl + $(download Orthanc) ))
dl=$(( $dl + $(download libModalityWorklists.so) ))
dl=$(( $dl + $(download libServeFolders.so) ))
dl=$(( $dl + $(download libHousekeeper.so) ))
dl=$(( $dl + $(download libConnectivityChecks.so) ))
dl=$(( $dl + $(download libDelayedDeletion.so) ))
dl=$(( $dl + $(download libMultitenantDicom.so) ))

if [[ $dl != 0 ]]; then

Expand All @@ -95,7 +95,7 @@ if [[ $target == "orthanc" ]]; then

elif [[ $target == "orthanc-authorization" ]]; then

dl=$(expr $dl + $(download libOrthancAuthorization.so))
dl=$(( $dl + $(download libOrthancAuthorization.so) ))

if [[ $dl != 0 ]]; then

Expand All @@ -107,4 +107,124 @@ elif [[ $target == "orthanc-authorization" ]]; then

upload libOrthancAuthorization.so
fi

elif [[ $target == "orthanc-python" ]]; then

dl=$(( $dl + $(download libOrthancPython.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-python/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DPYTHON_VERSION=3.9 $sourcesRootPath
make -j 4

upload libOrthancPython.so
fi

elif [[ $target == "orthanc-gdcm" ]]; then

dl=$(( $dl + $(download libOrthancGdcm.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-gdcm/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DSTATIC_BUILD=ON $sourcesRootPath
make -j 4

upload libOrthancGdcm.so
fi

elif [[ $target == "orthanc-pg" ]]; then

dl=$(( $dl + $(download libOrthancPostgreSQLIndex.so) ))
dl=$(( $dl + $(download libOrthancPostgreSQLStorage.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF $sourcesRootPath/PostgreSQL
make -j 4

upload libOrthancPostgreSQLIndex.so
upload libOrthancPostgreSQLStorage.so
fi

elif [[ $target == "orthanc-mysql" ]]; then

dl=$(( $dl + $(download libOrthancMySQLIndex.so) ))
dl=$(( $dl + $(download libOrthancMySQLStorage.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF $sourcesRootPath/MySQL
make -j 4

upload libOrthancMySQLIndex.so
upload libOrthancMySQLStorage.so
fi

elif [[ $target == "orthanc-odbc" ]]; then

dl=$(( $dl + $(download libOrthancOdbcIndex.so) ))
dl=$(( $dl + $(download libOrthancOdbcStorage.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-databases/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF $sourcesRootPath/MySQL
make -j 4

upload libOrthancOdbcIndex.so
upload libOrthancOdbcStorage.so
fi

elif [[ $target == "orthanc-indexer" ]]; then

dl=$(( $dl + $(download libOrthancIndexer.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-indexer/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_LIBCSV=OFF $sourcesRootPath
make -j 4

upload libOrthancIndexer.so
fi

elif [[ $target == "orthanc-neuro" ]]; then

dl=$(( $dl + $(download libOrthancNeuro.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-neuro/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_NIFTILIB=OFF $sourcesRootPath
make -j 4

upload libOrthancNeuro.so
fi

elif [[ $target == "orthanc-tcia" ]]; then

dl=$(( $dl + $(download libOrthancTcia.so) ))

if [[ $dl != 0 ]]; then

hg clone https://hg.orthanc-server.com/orthanc-tcia/ -r $commitId $sourcesRootPath
pushd $buildRootPath
cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DUSE_SYSTEM_LIBCSV=OFF $sourcesRootPath
make -j 4

upload libOrthancTcia.so
fi

fi

13 changes: 11 additions & 2 deletions local-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ if [[ $type == "local" ]]; then
# when building locally, use Docker builder (easier to reuse local images)
build="build"
push_load_arg=

prefer_downloads=1
enable_upload=0
else
from_cache_arg_runner_base="--cache-from=osimis/orthanc-runner-base:cache-$BASE_BUILDER_IMAGE_TAG"
to_cache_arg_runner_base="--cache-to=osimis/orthanc-runner-base:cache-$BASE_BUILDER_IMAGE_TAG"
Expand All @@ -133,6 +136,9 @@ else

# when building in CI, don't use intermediate targets (it would push plenty of images)
buildTargets=$finalImageTarget

prefer_downloads=1
enable_upload=1
fi


Expand Down Expand Up @@ -245,8 +251,11 @@ for target in $buildTargets; do
--build-arg ORTHANC_VOLVIEW_COMMIT_ID=$ORTHANC_VOLVIEW_COMMIT_ID \
--build-arg ORTHANC_OHIF_COMMIT_ID=$ORTHANC_OHIF_COMMIT_ID \
--build-arg BASE_IMAGE_TAG=$BASE_BUILDER_IMAGE_TAG \
--build-arg AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--build-arg AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--build-arg ARG_AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--build-arg ARG_AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--build-arg PREFER_DOWNLOADS=$prefer_downloads \
--build-arg ENABLE_UPLOAD=$enable_upload \
--build-arg PLATFORM=$platform \
$from_cache_arg \
$to_cache_arg \
$push_load_arg \
Expand Down

0 comments on commit 7657e82

Please sign in to comment.