summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/opentelemetry-cpp/docker/build.sh
blob: 53773b739f1c29bb2eae80b4742746dcc4571a66 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

set -o errexit
set -o nounset
set -o pipefail

Help()
{
   # Display Help
   echo "Add description of the script functions here."
   echo
   echo "Syntax: scriptTemplate [-b|o|g|j]"
   echo "options:"
   echo "b     Base image"
   echo "o     OpenTelemetry-cpp git tag"
   echo "h     Print Help."
   echo "g     gRPC git tag"
   echo "t     thrift version"
   echo "j     Parallel jobs"
   echo
   echo "how to use:"
   echo
   echo "docker create -ti --name otel otel-cpp-<base_image> bash"
   echo "docker cp otel:/ ./"
   echo "docker rm -f otel"
   echo
   echo "or:"
   echo
   echo "COPY --from=otel-cpp-<base_image> /usr"
}

base_image=${base_image:="alpine"}
grpc_git_tag=${grpc_git_tag:="v1.43.2"}
thrift_version=${thrift_version:="0.14.1"}
otel_git_tag=${otel_git_tag:="v1.3.0"}
cores=${cores:=1}

while getopts ":h:b:o:g:j:t:" option; do
   case $option in
    h) # display Help
         Help
         exit;;
    b) # base image
        base_image=$OPTARG
        ;;
    o) # OpenTelemetry-cpp git tag
        otel_git_tag=$OPTARG
        ;;
    g) # gRPC git tag
        grpc_git_tag=$OPTARG
        ;;
    t) # thrfit version
        thrift_version=$OPTARG
        ;;
    j) # number of cores
        cores=$OPTARG
        ;;
    \?)
        Help
        exit;;
   esac
done

docker build -t base-${base_image}-dev -f Dockerfile.${base_image}.base .

pushd grpc/
docker build --build-arg BASE_IMAGE=base-${base_image}-dev \
    --build-arg GRPC_GIT_TAG=${grpc_git_tag} \
    --build-arg CORES=${cores} \
    -t grpc-${base_image} -f Dockerfile .
popd

pushd thrift/
docker build --build-arg BASE_IMAGE=base-${base_image}-dev \
    --build-arg THRIFT_VERSION=${thrift_version} \
    --build-arg CORES=${cores} \
    -t thrift-${base_image} -f Dockerfile .
popd

docker build --build-arg BASE_IMAGE=${base_image} \
    --build-arg CORES=${cores} \
    --build-arg OTEL_GIT_TAG=${otel_git_tag} \
    -t otel-cpp-${base_image} -f Dockerfile .