annotate Resources/Builders/Debian/docker-internal.sh @ 108:2389ec6ec803

preparing for release
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Feb 2022 18:40:20 +0100
parents 53f3920af4c3
children 3678a028f1f6
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
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 set -ex
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
4 BUILD_TYPE=$1
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
5 PYTHON_VERSION=$2
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
6 USER_ID=$3
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
7 GROUP_ID=$4
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
8
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
9 # 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
10 # "./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
11 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
12 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
13
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
14 apt-get update
90
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
15 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
16 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
17 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
18
90
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
19
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
20 # 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
21 # '/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
22 # 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
23 # 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
24 MERCURIAL=mercurial-5.4.1
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
25 cd /tmp
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
26 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
27 tar xvf ${MERCURIAL}.tar.gz
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
28 export PATH=${PATH}:/tmp/${MERCURIAL}/
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
29
53f3920af4c3 install Mercurial from sources in Docker for Debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
30
9
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
31 mkdir /tmp/source-writeable
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
32
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
33 cp -r /source/CMakeLists.txt /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
34 cp -r /source/Sources /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
35 cp -r /source/Resources /tmp/source-writeable/
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
36
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 mkdir /tmp/build
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 cd /tmp/build
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
9
8ec973ae8d6c fix docker builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
40 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
41 -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
42 -DPYTHON_VERSION=${PYTHON_VERSION} \
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 -DSTATIC_BUILD=ON \
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 -DCMAKE_INSTALL_PREFIX=/target
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 make -j`nproc`
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 if [ "$1" == "Release" ]; then
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 strip ./libOrthancPython.so
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 fi
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
88
81a0975a2479 distinguishing Debian docker-based builds between buster and bullseye
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 9
diff changeset
52 # 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
53 # 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
54 # 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
55 # 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
56 su -c "cp /tmp/build/libOrthancPython.so /target" orthanc