This repository has been archived by the owner on Sep 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
build_docker_images.sh
executable file
·88 lines (74 loc) · 3 KB
/
build_docker_images.sh
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
87
88
#!/bin/bash
set -euo pipefail
# Requires: Bash shell on Windows (cygwin/Git bash), Linux, or Mac OS.
#
# This script builds FOUR docker containers:
# (1) ambrosia-dev: the core library, sources, and binaries
# (2) ambrosia: the binary release only
# (3) ambrosia-perftest: an example application C#
# (4) ambrosia-nativeapp: an example application C/Nativecode
#
# Run this inside a fresh working copy.
echo "********* Running build_docker_images.sh ********************"
echo "Args: "$@
echo "*******************************************************************"
TAG1A=ambrosia/ambrosia-dev
TAG1B=ambrosia/ambrosia
TAG2=ambrosia/ambrosia-perftest
TAG3=ambrosia/ambrosia-nativeapp
if ! [[ ${DOCKER:+defined} ]]; then
DOCKER=docker
fi
export AMBROSIA_ROOT=`pwd`
# Default logs location:
if [ `uname` == "Linux" ]; then
AMBROSIA_LOGDIR="/tmp/logs"
else
AMBROSIA_LOGDIR="c:\\logs"
fi
echo "================================================================================"
if [[ ${DONT_BUILD_APP_IMAGES:+defined} ]];
then echo "Building Docker images: $TAG1A, $TAG1B"
else echo "Building Docker images: $TAG1A, $TAG1B, $TAG2, $TAG3"
fi
echo "================================================================================"
echo
$DOCKER build -t ${TAG1A} .
echo "****************************************** Build Release ********************************"
if ! [[ ${DONT_BUILD_RELEASE_IMAGE:+defined} ]]; then
echo;echo "Building Release Image: $TAG1B"; echo
$DOCKER build -f Dockerfile.release -t ${TAG1B} .
fi
echo "****************************************** Build App Image ********************************"
if ! [[ ${DONT_BUILD_APP_IMAGES:+defined} ]]; then
if ! [[ ${DONT_BUILD_PTI_IMAGE:+defined} ]]; then
echo "****************************************** FIRST App Image ********************************"
echo;echo "Building App Image: $TAG2"; echo
cd "$AMBROSIA_ROOT"/InternalImmortals/PerformanceTestInterruptible
#*#*#*#*#* COMMENTED OUT FOR DEBUG $DOCKER build -t ${TAG2} .
cd "$AMBROSIA_ROOT"
fi
if ! [[ ${DONT_BUILD_NATIVE_IMAGE:+defined} ]]; then
echo "****************************************** Second App Image ********************************"
echo;echo "Building App Image: $TAG3"; echo
cd "$AMBROSIA_ROOT"/InternalImmortals/NativeService
docker build -t ${TAG3} .
cd "$AMBROSIA_ROOT"
fi
fi
echo
echo "****************************************** Docker images built successfully. ********************************"
echo
echo "Below is an example command bring up the generated image interactively:"
echo " $DOCKER run -it --rm --env AZURE_STORAGE_CONN_STRING=... ${TAG2}"
if ! [[ ${DONT_BUILD_TARBALL:+defined} ]]; then
echo
echo "Extracting a release tarball..."
set -x
rm -rf ambrosia.tgz
TMPCONT=temp-container-name_`date '+%s'`
$DOCKER run --name $TMPCONT $TAG1A bash -c 'tar czf /ambrosia/ambrosia.tgz /ambrosia/bin'
$DOCKER cp $TMPCONT:/ambrosia/ambrosia.tgz ambrosia.tgz
$DOCKER rm $TMPCONT
set +x
fi