comparison Resources/CreateOHIFDist.sh @ 0:39585ba26f20

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Jun 2023 09:48:46 +0200
parents
children cc0e9401b027
comparison
equal deleted inserted replaced
-1:000000000000 0:39585ba26f20
1 #!/bin/bash
2
3 # SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 # OHIF plugin for Orthanc
7 # Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
8 #
9 # This program is free software: you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation, either version 3 of the
12 # License, or (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22
23
24 # This command-line script uses the "yarn" tool to populate the "dist"
25 # folder of OHIF. It uses Docker to this end, in order to be usable on
26 # our CIS.
27
28 set -ex
29
30 if [ "$1" = "" ]; then
31 PACKAGE=Viewers-3.6.0
32 else
33 PACKAGE=$1
34 fi
35
36 if [ -t 1 ]; then
37 # TTY is available => use interactive mode
38 DOCKER_FLAGS='-i'
39 fi
40
41 ROOT_DIR=`dirname $(readlink -f $0)`/..
42 IMAGE=orthanc-ohif-node
43
44 echo "Creating the distribution of OHIF from $PACKAGE"
45
46 if [ -e "${ROOT_DIR}/OHIF/dist/" ]; then
47 echo "Target folder is already existing, aborting"
48 exit -1
49 fi
50
51 if [ ! -f "${ROOT_DIR}/OHIF/${PACKAGE}.tar.gz" ]; then
52 ( cd ${ROOT_DIR}/OHIF && \
53 wget https://orthanc.uclouvain.be/third-party-downloads/OHIF/${PACKAGE}.tar.gz )
54 fi
55
56 mkdir -p ${ROOT_DIR}/OHIF/dist/
57
58 ( cd ${ROOT_DIR}/Resources/CreateOHIFDist && \
59 docker build --no-cache -t ${IMAGE} . )
60
61 docker run -t ${DOCKER_FLAGS} --rm \
62 --user $(id -u):$(id -g) \
63 -v ${ROOT_DIR}/Resources/CreateOHIFDist/build.sh:/source/build.sh:ro \
64 -v ${ROOT_DIR}/OHIF/${PACKAGE}.tar.gz:/source/${PACKAGE}.tar.gz:ro \
65 -v ${ROOT_DIR}/OHIF/dist/:/target:rw \
66 ${IMAGE} \
67 bash /source/build.sh ${PACKAGE}