changeset 2:ad2fc4ec99fb

fix missing "patch" command-line tool in Docker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Mar 2023 11:51:32 +0100
parents 3518c3c41b30
children 6002fc2c98cf
files Resources/CreateVolViewDist-build.sh Resources/CreateVolViewDist.sh Resources/CreateVolViewDist/Dockerfile Resources/CreateVolViewDist/build.sh
diffstat 4 files changed, 71 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CreateVolViewDist-build.sh	Wed Mar 22 10:32:18 2023 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-# SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# Kitware's VolView plugin for Orthanc
-# Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
-#
-# This program is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -ex
-
-if [ "$1" = "" ]; then
-    echo "Please provide a version number of VolView"
-    exit -1
-fi
-
-apt update
-apt install patch
-
-cd /tmp/
-tar xvf /source/VolView-$1.tar.gz
-
-cd /tmp/VolView-$1
-patch -p1 < /source/VolView-$1.patch
-npm install --cache /tmp/npm-cache
-npm run build --cache /tmp/npm-cache
-
-cp -r /tmp/VolView-$1/dist/* /target
--- a/Resources/CreateVolViewDist.sh	Wed Mar 22 10:32:18 2023 +0100
+++ b/Resources/CreateVolViewDist.sh	Wed Mar 22 11:51:32 2023 +0100
@@ -39,7 +39,7 @@
 fi
 
 ROOT_DIR=`dirname $(readlink -f $0)`/..
-IMAGE=node:19.7.0-bullseye-slim
+IMAGE=orthanc-volview-node
 
 echo "Creating the distribution of VolView $VERSION"
 
@@ -49,14 +49,18 @@
 fi
 
 if [ ! -f "${ROOT_DIR}/VolView/VolView-${VERSION}.tar.gz" ]; then
-    ( cd ${ROOT_DIR}/VolView && wget https://orthanc.uclouvain.be/third-party-downloads/VolView-${VERSION}.tar.gz )
+    ( cd ${ROOT_DIR}/VolView && \
+          wget https://orthanc.uclouvain.be/third-party-downloads/VolView-${VERSION}.tar.gz )
 fi
 
 mkdir -p ${ROOT_DIR}/VolView/dist/
 
+( cd ${ROOT_DIR}/Resources/CreateVolViewDist && \
+      docker build --no-cache -t ${IMAGE} . )
+
 docker run -t ${DOCKER_FLAGS} --rm \
        --user $(id -u):$(id -g) \
-       -v ${ROOT_DIR}/Resources/CreateVolViewDist-build.sh:/source/build.sh:ro \
+       -v ${ROOT_DIR}/Resources/CreateVolViewDist/build.sh:/source/build.sh:ro \
        -v ${ROOT_DIR}/VolView/VolView-${VERSION}.patch:/source/VolView-${VERSION}.patch:ro \
        -v ${ROOT_DIR}/VolView/VolView-${VERSION}.tar.gz:/source/VolView-${VERSION}.tar.gz:ro \
        -v ${ROOT_DIR}/VolView/dist/:/target:rw \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CreateVolViewDist/Dockerfile	Wed Mar 22 11:51:32 2023 +0100
@@ -0,0 +1,27 @@
+# SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# Kitware's VolView plugin for Orthanc
+# Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+FROM node:19.7.0-bullseye-slim
+
+MAINTAINER Sebastien Jodogne <s.jodogne@gmail.com>
+LABEL Description="Orthanc, free DICOM server" Vendor="The Orthanc project"
+
+RUN apt-get -y clean && apt-get -y update && \
+    DEBIAN_FRONTEND=noninteractive apt-get -y install patch && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CreateVolViewDist/build.sh	Wed Mar 22 11:51:32 2023 +0100
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# Kitware's VolView plugin for Orthanc
+# Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -ex
+
+if [ "$1" = "" ]; then
+    echo "Please provide a version number of VolView"
+    exit -1
+fi
+
+cd /tmp/
+tar xvf /source/VolView-$1.tar.gz
+
+cd /tmp/VolView-$1
+patch -p1 < /source/VolView-$1.patch
+npm install --cache /tmp/npm-cache
+npm run build --cache /tmp/npm-cache
+
+cp -r /tmp/VolView-$1/dist/* /target