Mercurial > hg > orthanc-python
changeset 88:81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Aug 2021 11:11:55 +0200 |
parents | 01df28d28247 |
children | 74a51200a134 |
files | Resources/Builders/Debian/docker-bullseye-compile.sh Resources/Builders/Debian/docker-buster-compile.sh Resources/Builders/Debian/docker-internal.sh Resources/Builders/DebianStable/Dockerfile-BuildEnvironment Resources/Builders/DebianStable/Dockerfile-Release Resources/Builders/DebianStable/NOTES.txt Resources/Builders/DebianStable/docker-compile.sh Resources/Builders/DebianStable/docker-internal.sh |
diffstat | 8 files changed, 98 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Builders/Debian/docker-bullseye-compile.sh Thu Aug 19 11:11:55 2021 +0200 @@ -0,0 +1,27 @@ +#!/bin/bash + +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)`/../../.. + +mkdir -p ${ROOT_DIR}/docker-build-bullseye/ + +docker pull debian:bullseye-slim + +docker run -t ${DOCKER_FLAGS} --rm \ + -v ${ROOT_DIR}:/source:ro \ + -v ${ROOT_DIR}/docker-build-bullseye:/target:rw \ + debian:bullseye-slim \ + bash /source/Resources/Builders/Debian/docker-internal.sh $1 3.9 $(id -u) $(id -g) + +ls -lR ${ROOT_DIR}/docker-build-bullseye/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Builders/Debian/docker-buster-compile.sh Thu Aug 19 11:11:55 2021 +0200 @@ -0,0 +1,27 @@ +#!/bin/bash + +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)`/../../.. + +mkdir -p ${ROOT_DIR}/docker-build-buster/ + +docker pull debian:buster-slim + +docker run -t ${DOCKER_FLAGS} --rm \ + -v ${ROOT_DIR}:/source:ro \ + -v ${ROOT_DIR}/docker-build-buster:/target:rw \ + debian:buster-slim \ + bash /source/Resources/Builders/Debian/docker-internal.sh $1 3.7 $(id -u) $(id -g) + +ls -lR ${ROOT_DIR}/docker-build-buster/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Builders/Debian/docker-internal.sh Thu Aug 19 11:11:55 2021 +0200 @@ -0,0 +1,44 @@ +#!/bin/bash +set -ex + +BUILD_TYPE=$1 +PYTHON_VERSION=$2 +USER_ID=$3 +GROUP_ID=$4 + +# Create the same user and group than the one who is running the +# "./docker-{distro}-compile.sh" script on the hosting system (*) +groupadd -g ${GROUP_ID} -r orthanc +useradd -u ${USER_ID} -r -g orthanc orthanc + +apt-get update +apt-get -y install nano build-essential unzip cmake pkg-config libpython3-dev mercurial +apt-get clean +rm -rf /var/lib/apt/lists/* + +mkdir /tmp/source-writeable + +cp -r /source/CMakeLists.txt /tmp/source-writeable/ +cp -r /source/Sources /tmp/source-writeable/ +cp -r /source/Resources /tmp/source-writeable/ + +mkdir /tmp/build +cd /tmp/build + +cmake /tmp/source-writeable/ \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DPYTHON_VERSION=${PYTHON_VERSION} \ + -DSTATIC_BUILD=ON \ + -DCMAKE_INSTALL_PREFIX=/target + +make -j`nproc` + +if [ "$1" == "Release" ]; then + strip ./libOrthancPython.so +fi + +# 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/libOrthancPython.so /target" orthanc
--- a/Resources/Builders/DebianStable/Dockerfile-BuildEnvironment Thu Aug 12 18:39:05 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -FROM debian:stable-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 \ - nano build-essential unzip cmake pkg-config libpython3.7-dev mercurial && \ - apt-get clean && rm -rf /var/lib/apt/lists/*
--- a/Resources/Builders/DebianStable/Dockerfile-Release Thu Aug 12 18:39:05 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -FROM jodogne/orthanc-plugins:1.6.0 - -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 -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python3.7 libpython3.7 && \ - apt-get clean && rm -rf /var/lib/apt/lists/* - -ADD ./docker-build/share/orthanc/plugins/libOrthancPython.so \ - /usr/local/share/orthanc/plugins/libOrthancPython.so
--- a/Resources/Builders/DebianStable/NOTES.txt Thu Aug 12 18:39:05 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - -Create the Docker image: - -$ ./docker-compile.sh Release -$ docker build -f Dockerfile-Release -t python-plugin ../../.. - - -Run the just-created Docker image: - -$ docker run -p 4242:4242 -p 8042:8042 --rm python-plugin -
--- a/Resources/Builders/DebianStable/docker-compile.sh Thu Aug 12 18:39:05 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#!/bin/bash - -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)`/../../.. - -mkdir -p ${ROOT_DIR}/docker-build/ - -docker build \ - -f ${ROOT_DIR}/Resources/Builders/DebianStable/Dockerfile-BuildEnvironment \ - -t debian-stable-python-build . - -docker run -t ${DOCKER_FLAGS} --rm \ - --user $(id -u):$(id -g) \ - -v ${ROOT_DIR}:/source:ro \ - -v ${ROOT_DIR}/docker-build:/target:rw \ - debian-stable-python-build \ - bash /source/Resources/Builders/DebianStable/docker-internal.sh $1 - -ls -lR ${ROOT_DIR}/docker-build/
--- a/Resources/Builders/DebianStable/docker-internal.sh Thu Aug 12 18:39:05 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#!/bin/bash -set -ex - -mkdir /tmp/source-writeable - -cp -r /source/CMakeLists.txt /tmp/source-writeable/ -cp -r /source/Sources /tmp/source-writeable/ -cp -r /source/Resources /tmp/source-writeable/ - -mkdir /tmp/build -cd /tmp/build - -cmake /tmp/source-writeable/ \ - -DCMAKE_BUILD_TYPE=$1 \ - -DPYTHON_VERSION=3.7 \ - -DSTATIC_BUILD=ON \ - -DCMAKE_INSTALL_PREFIX=/target - -make -j`nproc` - -if [ "$1" == "Release" ]; then - strip ./libOrthancPython.so -fi - -make install