summaryrefslogtreecommitdiffstats
path: root/makeself/build-x86_64-static.sh
blob: 35766609357e5bcd008c287ec726dca68d7d7f3c (plain)
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
38
39
40
41
#!/usr/bin/env bash

. $(dirname "$0")/../installer/functions.sh || exit 1

set -e

DOCKER_CONTAINER_NAME="netdata-package-x86_64-static-alpine37"

if ! sudo docker inspect "${DOCKER_CONTAINER_NAME}" >/dev/null 2>&1
then
    # To run interactively:
    #   sudo docker run -it netdata-package-x86_64-static /bin/sh
    # (add -v host-dir:guest-dir:rw arguments to mount volumes)
    #
    # To remove images in order to re-create:
    #   sudo docker rm -v $(sudo docker ps -a -q -f status=exited)
    #   sudo docker rmi netdata-package-x86_64-static
    #
    # This command maps the current directory to
    #   /usr/src/netdata.git
    # inside the container and runs the script install-alpine-packages.sh
    # (also inside the container)
    #
    run sudo docker run -v $(pwd):/usr/src/netdata.git:rw alpine:3.7 \
        /bin/sh /usr/src/netdata.git/makeself/install-alpine-packages.sh

    # save the changes made permanently
    id=$(sudo docker ps -l -q)
    run sudo docker commit ${id} "${DOCKER_CONTAINER_NAME}"
fi

# Run the build script inside the container
run sudo docker run -a stdin -a stdout -a stderr -i -t -v \
    $(pwd):/usr/src/netdata.git:rw \
    "${DOCKER_CONTAINER_NAME}" \
    /bin/sh /usr/src/netdata.git/makeself/build.sh "${@}"

if [ "${USER}" ]
    then
    sudo chown -R "${USER}" .
fi