File: build_package_install_test.sh

package info (click to toggle)
netdata 1.37.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,364 kB
  • sloc: ansic: 302,654; javascript: 77,865; python: 27,094; sh: 18,726; cpp: 2,916; makefile: 2,547; pascal: 171; xml: 10
file content (37 lines) | stat: -rwxr-xr-x 997 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later

set -e

# If we are not in netdata git repo, at the top level directory, FAIL
TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
CWD=$(git rev-parse --show-cdup || echo "")
if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" = "netdata" ]; then
  echo "Run as ./packaging/$(basename "$0") from top level directory of netdata git repository"
  exit 1
fi

if [ $# -lt 2 ] || [ $# -gt 3 ]; then
  echo "Usage: ./packaging/$(basename "$0") <distro> <distro_version> [<netdata_version>]"
  exit 1
fi

if ! command -v docker > /dev/null; then
  echo "Docker CLI not found. You need Docker to run this!"
  exit 2
fi

DISTRO="$1"
DISTRO_VERSION="$2"
# TODO: Auto compute this?
VERSION="${3:-1.19.0}"

TAG="netdata/netdata:${DISTRO}_${DISTRO_VERSION}"

docker build \
  -f ./packaging/Dockerfile.packager \
  --build-arg DISTRO="$DISTRO" \
  --build-arg DISTRO_VERSION="$DISTRO_VERSION" \
  --build-arg VERSION="$VERSION" \
  -t "$TAG" . |
  tee build.log