source: ntrip/trunk/BNC/docker/build.sh@ 10771

Last change on this file since 10771 was 10771, checked in by wiese, 6 weeks ago

ADD: dockerfiles: qt5 serialport libs

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/bin/bash
2
3# Build BNC from sources for multiple operating systems
4# On redhat/centos install "dnf install podman-docker"
5# Wiese, 2022
6
7set -e
8cd "$(dirname $0)/.."
9
10bncvers=$(grep "#define BNCVERSION \"" src/bncversion.h | cut -d " " -f3 | tr -d \")
11if [ -z "$bncvers" ]; then
12 echo "ERROR: could not find bncvers"; exit 1
13fi
14
15# Run image, copy the compiled executable "bncnew" from the container
16# and then remove the container.
17function getBncFromImage () {
18 local image="$1"
19 local imgID=$(docker images --format "{{.ID}}" $image)
20 local con=$(docker create $imgID)
21 docker cp $con:/tmp/BNC/bnc bncnew
22 docker rm $con
23 [ -s "bncnew" ] || { echo "executable \"bncnew\" does not exist"; exit 1; }
24}
25
26function buildBullseye () {
27 echo "Build BNC $bncvers for debian 11 (bullseye) ..."
28 [ -f "bncnew" ] && rm bncnew
29 docker build -t bullseye/bnc:v$bncvers -f docker/Dockerfile.bullseye .
30 getBncFromImage "bullseye/bnc:v$bncvers"
31 target=$(realpath "bnc-$bncvers-debian11")
32 mv bncnew $target
33 echo "$target created"
34}
35
36function buildBookworm () {
37 echo "Build BNC $bncvers for debian 12 (bookworm) ..."
38 [ -f "bncnew" ] && rm bncnew
39 docker build -t bookworm/bnc:v$bncvers -f docker/Dockerfile.bookworm .
40 getBncFromImage "bookworm/bnc:v$bncvers"
41 target=$(realpath "bnc-$bncvers-debian12")
42 mv bncnew $target
43 echo "$target created"
44}
45
46function buildTrixie () {
47 echo "Build BNC $bncvers for debian 13 (trixie) ..."
48 [ -f "bncnew" ] && rm bncnew
49 docker build -t trixie/bnc:v$bncvers -f docker/Dockerfile.trixie .
50 getBncFromImage "trixie/bnc:v$bncvers"
51 target=$(realpath "bnc-$bncvers-debian13")
52 mv bncnew $target
53 echo "$target created"
54}
55
56function buildLeap () {
57 echo "Build BNC $bncvers for opensuse (leap) ..."
58 [ -f "bncnew" ] && rm bncnew
59 docker build -t leap/bnc:v$bncvers -f docker/Dockerfile.leap .
60 getBncFromImage "leap/bnc:v$bncvers"
61 target=$(realpath "bnc-$bncvers-leap")
62 mv bncnew $target
63 echo "$target created"
64}
65
66function buildUbi8 () {
67 echo "Build BNC $bncvers for redhat/ubi8 ..."
68 [ -f "bncnew" ] && rm bncnew
69 docker build -t ubi8.6/bnc:v$bncvers -f docker/Dockerfile.ubi8 .
70 getBncFromImage "ubi8.6/bnc:v$bncvers"
71 target=$(realpath "bnc-$bncvers-el8.6")
72 mv bncnew $target
73 echo "$target created"
74}
75
76# rockylinux 9/el9
77function buildRocky () {
78 echo "Build BNC $bncvers for rockylinux ..."
79 [ -f "bncnew" ] && rm bncnew
80 docker build -t rocky9/bnc:v$bncvers -f docker/Dockerfile.rocky9 .
81 getBncFromImage "rocky9/bnc:v$bncvers"
82 target=$(realpath "bnc-$bncvers-rocky9")
83 mv bncnew $target
84 echo "$target created"
85}
86
87case $1 in
88 "bullseye")
89 buildBullseye;
90 ;;
91 "bookworm")
92 buildBookworm;
93 ;;
94 "trixie")
95 buildTrixie;
96 ;;
97 "leap")
98 buildLeap;
99 ;;
100 "ubi")
101 buildUbi8;
102 ;;
103 "rocky")
104 buildRocky;
105 ;;
106 "all")
107 buildBookworm;
108 buildLeap;
109 buildUbi8;
110 ;;
111 *)
112 echo "Usage:"
113 echo " $0 { bullseye | leap | ubi | rocky | all }"
114 echo
115 exit 1;
116 ;;
117esac
118
Note: See TracBrowser for help on using the repository browser.