# HG changeset patch # User Sebastien Jodogne # Date 1629362194 -7200 # Node ID a45844994a6797ff8fdfcfec810b8c7be4225b41 # Parent 53efee7353962578f695e94daeb3bca4c3bd93b8 distinguishing docker-based builds between buster and bullseye diff -r 53efee735396 -r a45844994a67 Resources/debian-bullseye-compile.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/debian-bullseye-compile.sh Thu Aug 19 10:36:34 2021 +0200 @@ -0,0 +1,33 @@ +#!/bin/bash + +## +## This script compiles the plugin for Debian bullseye, in static +## mode. +## + +set -ex + +if [ "$1" != "Debug" -a "$1" != "Release" ]; then + echo "Please provide build type: Debug or Release" + exit -1 +fi + +if [ -t 1 ]; then + # TTY is available => use interactive mode + DOCKER_FLAGS='-i' +fi + +ROOT_DIR=`dirname $(readlink -f $0)`/.. + +# Always make sure we use the latest version of Debian bullseye +docker pull debian:bullseye + +mkdir -p ${ROOT_DIR}/debian-bullseye + +docker run -t ${DOCKER_FLAGS} --rm \ + -v ${ROOT_DIR}:/source:ro \ + -v ${ROOT_DIR}/debian-bullseye:/target:rw \ + debian:bullseye \ + bash /source/Resources/debian-internal.sh $1 $(id -u) $(id -g) + +ls -l ${ROOT_DIR}/debian-bullseye/ diff -r 53efee735396 -r a45844994a67 Resources/debian-buster-compile.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/debian-buster-compile.sh Thu Aug 19 10:36:34 2021 +0200 @@ -0,0 +1,35 @@ +#!/bin/bash + +## +## This script compiles the plugin for Debian buster, in static +## mode. The resulting binaries can be used in the Docker images of +## Orthanc, as those are also based on Debian buster: +## https://github.com/jodogne/OrthancDocker/blob/master/orthanc/Dockerfile +## + +set -ex + +if [ "$1" != "Debug" -a "$1" != "Release" ]; then + echo "Please provide build type: Debug or Release" + exit -1 +fi + +if [ -t 1 ]; then + # TTY is available => use interactive mode + DOCKER_FLAGS='-i' +fi + +ROOT_DIR=`dirname $(readlink -f $0)`/.. + +# Always make sure we use the latest version of Debian buster +docker pull debian:buster + +mkdir -p ${ROOT_DIR}/debian-buster + +docker run -t ${DOCKER_FLAGS} --rm \ + -v ${ROOT_DIR}:/source:ro \ + -v ${ROOT_DIR}/debian-buster:/target:rw \ + debian:buster \ + bash /source/Resources/debian-internal.sh $1 $(id -u) $(id -g) + +ls -l ${ROOT_DIR}/debian-buster/ diff -r 53efee735396 -r a45844994a67 Resources/debian-internal.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/debian-internal.sh Thu Aug 19 10:36:34 2021 +0200 @@ -0,0 +1,33 @@ +#!/bin/bash + +set -ex + +BUILD_TYPE=$1 +USER_ID=$2 +GROUP_ID=$3 + +# Create the same user and group than the one who is running the +# "./debian-{distro}-compile.sh" script on the hosting system (*) +groupadd -g ${GROUP_ID} -r orthanc +useradd -u ${USER_ID} -r -g orthanc orthanc + +# Static build using the root user +apt-get update +apt-get install -y cmake build-essential unzip mercurial + +mkdir /tmp/build +cd /tmp/build + +cp -r /source /tmp/source-writeable +cmake /tmp/source-writeable \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DSTATIC_BUILD=ON \ + -DCMAKE_INSTALL_PREFIX=/target + +make -j`nproc` + +# Copy the installation to the host filesystem, using the +# newly-created user "orthanc" (*) that corresponds to the user who is +# running "./debian-{distro}-compile.sh" script. This allows to avoid +# files owned by the "root" user on the host filesystem. +su -c "cp /tmp/build/libOrthancGoogleCloudPlatform.so /target" orthanc diff -r 53efee735396 -r a45844994a67 Resources/debian-stable-compile.sh --- a/Resources/debian-stable-compile.sh Wed Jun 23 09:03:43 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#!/bin/bash - -## -## This script compiles the plugin for Debian stable, in static -## mode. The resulting binaries can be used in the Docker images of -## Orthanc, as those are also based on Debian stable: -## https://github.com/jodogne/OrthancDocker/blob/master/orthanc/Dockerfile -## - -set -ex - -if [ "$1" != "Debug" -a "$1" != "Release" ]; then - echo "Please provide build type: Debug or Release" - exit -1 -fi - -if [ -t 1 ]; then - # TTY is available => use interactive mode - DOCKER_FLAGS='-i' -fi - -ROOT_DIR=`dirname $(readlink -f $0)`/.. - -# Always make sure we use the latest version of Debian stable -docker pull debian:stable - -mkdir -p ${ROOT_DIR}/debian-stable - -docker run -t ${DOCKER_FLAGS} --rm \ - -v ${ROOT_DIR}:/source:ro \ - -v ${ROOT_DIR}/debian-stable:/target:rw \ - debian:stable \ - bash /source/Resources/debian-stable-internal.sh $1 $(id -u) $(id -g) - -ls -l ${ROOT_DIR}/debian-stable/ diff -r 53efee735396 -r a45844994a67 Resources/debian-stable-internal.sh --- a/Resources/debian-stable-internal.sh Wed Jun 23 09:03:43 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#!/bin/bash - -set -ex - -BUILD_TYPE=$1 -USER_ID=$2 -GROUP_ID=$3 - -# Create the same user and group than the one who is running the -# "./debian-stable-compile.sh" script on the hosting system (*) -groupadd -g ${GROUP_ID} -r orthanc -useradd -u ${USER_ID} -r -g orthanc orthanc - -# Static build using the root user -apt-get update -apt-get install -y cmake build-essential unzip mercurial - -mkdir /tmp/build -cd /tmp/build - -cp -r /source /tmp/source-writeable -cmake /tmp/source-writeable \ - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DSTATIC_BUILD=ON \ - -DCMAKE_INSTALL_PREFIX=/target - -make -j`nproc` - -# Copy the installation to the host filesystem, using the -# newly-created user "orthanc" (*) that corresponds to the user who is -# running "./debian-stable-compile.sh" script. This allows to avoid -# files owned by the "root" user on the host filesystem. -su -c "cp /tmp/build/libOrthancGoogleCloudPlatform.so /target" orthanc