annotate Resources/Builders/Debian/docker-internal.sh @ 227:9574f06d8588 default tip

todo
author Alain Mazy <am@orthanc.team>
date Tue, 24 Sep 2024 08:54:11 +0200
parents 49b5413699d3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/bin/bash
219
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
2
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
3 # SPDX-FileCopyrightText: 2020-2023 Osimis S.A., 2024-2024 Orthanc Team SRL, 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
4 # SPDX-License-Identifier: AGPL-3.0-or-later
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
5
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
6 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
7 ## Python plugin for Orthanc
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
8 ## Copyright (C) 2020-2023 Osimis S.A., Belgium
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
9 ## Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
10 ## Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
11 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
12 ## This program is free software: you can redistribute it and/or
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
13 ## modify it under the terms of the GNU Affero General Public License
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
14 ## as published by the Free Software Foundation, either version 3 of
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
15 ## the License, or (at your option) any later version.
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
16 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
17 ## This program is distributed in the hope that it will be useful, but
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
18 ## WITHOUT ANY WARRANTY; without even the implied warranty of
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
20 ## Affero General Public License for more details.
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
21 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
22 ## You should have received a copy of the GNU Affero General Public License
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
23 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
24 ##
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
25
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
26
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 set -ex
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
29 BUILD_TYPE=$1
224
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
30 DEBIAN_VERSION=$2
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
31 PYTHON_VERSION=$3
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
32 USER_ID=$4
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
33 GROUP_ID=$5
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
34
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
35 # Create the same user and group than the one who is running the
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
36 # "./docker-{distro}-compile.sh" script on the hosting system (*)
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
37 groupadd -g ${GROUP_ID} -r orthanc
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
38 useradd -u ${USER_ID} -r -g orthanc orthanc
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
39
224
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
40 if [ "${DEBIAN_VERSION}" = "bullseye" ]; then
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
41 MERCURIAL_PACKAGES=python
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
42 else
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
43 MERCURIAL_PACKAGES=mercurial
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
44 fi
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
45
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
46 apt-get update
224
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
47 DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config libpython3-dev curl ${MERCURIAL_PACKAGES}
89
74a51200a134 fix error in Docker with debconf
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 88
diff changeset
48 apt-get -y clean
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
49 rm -rf /var/lib/apt/lists/*
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
50
90
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
51
224
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
52 if [ "${DEBIAN_VERSION}" = "bullseye" ]; then
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
53 # On Bullseye, we get "stat: cannot statx
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
54 # '/usr/share/mercurial/hgext.rc': Operation not permitted" if
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
55 # installing the "mercurial" package using apt-get. As a consequence,
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
56 # we manually install Mercurial from sources.
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
57 MERCURIAL=mercurial-5.4.1
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
58 cd /tmp
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
59 curl https://www.mercurial-scm.org/release/${MERCURIAL}.tar.gz > ${MERCURIAL}.tar.gz
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
60 tar xvf ${MERCURIAL}.tar.gz
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
61 export PATH=${PATH}:/tmp/${MERCURIAL}/
49b5413699d3 added Docker-based builder scripts for Debian 12 (bookworm)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 219
diff changeset
62 fi
90
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
63
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
64
9
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
65 mkdir /tmp/source-writeable
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
66
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
67 cp -r /source/CMakeLists.txt /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
68 cp -r /source/Sources /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
69 cp -r /source/Resources /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
70
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 mkdir /tmp/build
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 cd /tmp/build
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
9
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
74 cmake /tmp/source-writeable/ \
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
75 -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
76 -DPYTHON_VERSION=${PYTHON_VERSION} \
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 -DSTATIC_BUILD=ON \
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 -DCMAKE_INSTALL_PREFIX=/target
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 make -j`nproc`
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 if [ "$1" == "Release" ]; then
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 strip ./libOrthancPython.so
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 fi
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
86 # Copy the installation to the host filesystem, using the
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
87 # newly-created user "orthanc" (*) that corresponds to the user who is
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
88 # running "./debian-{distro}-compile.sh" script. This allows to avoid
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
89 # files owned by the "root" user on the host filesystem.
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
90 su -c "cp /tmp/build/libOrthancPython.so /target" orthanc