Mercurial > hg > orthanc-python
annotate Resources/Builders/Debian/docker-internal.sh @ 219:3678a028f1f6
making the project REUSE-compliant
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Jul 2024 18:05:11 +0200 |
parents | 53f3920af4c3 |
children | 49b5413699d3 |
rev | line source |
---|---|
0 | 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 | 27 set -ex |
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 |
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
30 PYTHON_VERSION=$2 |
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
31 USER_ID=$3 |
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
32 GROUP_ID=$4 |
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
33 |
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
34 # 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
|
35 # "./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
|
36 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
|
37 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
|
38 |
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
39 apt-get update |
90
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
40 DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config python libpython3-dev curl |
89
74a51200a134
fix error in Docker with debconf
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
88
diff
changeset
|
41 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
|
42 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
|
43 |
90
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
44 |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
45 # On Bullseye, we get "stat: cannot statx |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
46 # '/usr/share/mercurial/hgext.rc': Operation not permitted" if |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
47 # installing the "mercurial" package using apt-get. As a consequence, |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
48 # we manually install Mercurial from sources. |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
49 MERCURIAL=mercurial-5.4.1 |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
50 cd /tmp |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
51 curl https://www.mercurial-scm.org/release/${MERCURIAL}.tar.gz > ${MERCURIAL}.tar.gz |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
52 tar xvf ${MERCURIAL}.tar.gz |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
53 export PATH=${PATH}:/tmp/${MERCURIAL}/ |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
54 |
53f3920af4c3
install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
55 |
9 | 56 mkdir /tmp/source-writeable |
57 | |
58 cp -r /source/CMakeLists.txt /tmp/source-writeable/ | |
59 cp -r /source/Sources /tmp/source-writeable/ | |
60 cp -r /source/Resources /tmp/source-writeable/ | |
61 | |
0 | 62 mkdir /tmp/build |
63 cd /tmp/build | |
64 | |
9 | 65 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
|
66 -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
|
67 -DPYTHON_VERSION=${PYTHON_VERSION} \ |
0 | 68 -DSTATIC_BUILD=ON \ |
69 -DCMAKE_INSTALL_PREFIX=/target | |
70 | |
71 make -j`nproc` | |
72 | |
73 if [ "$1" == "Release" ]; then | |
74 strip ./libOrthancPython.so | |
75 fi | |
76 | |
88
81a0975a2479
distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
77 # 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
|
78 # 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
|
79 # 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
|
80 # 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
|
81 su -c "cp /tmp/build/libOrthancPython.so /target" orthanc |