File: build

package info (click to toggle)
stactools 0.5.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,796 kB
  • sloc: python: 4,498; xml: 554; sh: 395; makefile: 34
file content (64 lines) | stat: -rwxr-xr-x 1,503 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash

set -e

if [[ -n "${STACTOOLS_DEBUG}" ]]; then
    set -x
fi

source $(dirname "$0")/env

function usage() {

    echo -n \
        "Usage: $(basename "$0")
Build stactools containers. Must be run from the repository root

Options:
--no-cache  Do not use cache when building the images
--pull      Attempt to pull upstream images before building
"
}

while [[ $# -gt 0 ]]
do
    key="$1"
    case $key in
        --help)
        usage
        exit 0
        shift
        ;;

        --no-cache)
        NO_CACHE="--no-cache"
        shift
        ;;

        --pull)
        PULL="--pull"
        shift
        ;;
    esac
done

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
    if [ "${1:-}" = "--help" ]; then
        usage
    else
        docker build $PULL $NO_CACHE --target main -t $DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_REPO:$DOCKER_TAG -f docker/Dockerfile .
        docker build $PULL $NO_CACHE --target dev -t $DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_REPO:$DOCKER_TAG_DEV -f docker/Dockerfile .
    fi

    # Wipe out the debug container if it still exists. It is now obsolete.
    if [ "$(docker ps -aqf name=$DOCKER_DEBUG_CONTAINER_NAME)" ]; then
        # Container exists
        if [ "$(docker ps -qf name=$DOCKER_DEBUG_CONTAINER_NAME)" ]; then
            # Container is runnking
            echo "Kill debug container"
            docker kill $DOCKER_DEBUG_CONTAINER_NAME
        fi
        echo "Remove debug container"
        docker rm -f $DOCKER_DEBUG_CONTAINER_NAME
    fi
fi