forked from facebookresearch/fbpcs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-docker-binaries.sh
executable file
·60 lines (51 loc) · 1.89 KB
/
extract-docker-binaries.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
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
PROG_NAME=$0
usage() {
cat << EOF >&2
Usage: $PROG_NAME <emp_games|data_processing> [-t TAG]
package:
emp_games - extracts the binaries from fbpcs/emp-games docker image
data_processing - extracts the binaries from fbpcs/data-processing docker image
-t TAG: uses the image with the given tag (default: latest)
EOF
exit 1
}
PACKAGES="emp_games data_processing"
PACKAGE=$1
if [[ ! " $PACKAGES " =~ $PACKAGE ]]; then
usage
fi
shift
TAG="latest"
while getopts "t:" o; do
case $o in
(t) TAG=$OPTARG;;
(*) usage
esac
done
shift "$((OPTIND - 1))"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Run from the root dir of so the binaries paths exist
cd "$SCRIPT_DIR" || exit
mkdir -p binaries_out
if [ "$PACKAGE" = "emp_games" ]; then
docker create -ti --name temp_container "fbpcs/emp-games:${TAG}"
docker cp temp_container:/usr/local/bin/lift_calculator "$SCRIPT_DIR/binaries_out/."
docker cp temp_container:/usr/local/bin/attribution_calculator "$SCRIPT_DIR/binaries_out/."
docker cp temp_container:/usr/local/bin/shard_aggregator "$SCRIPT_DIR/binaries_out/."
docker rm -f temp_container
fi
if [ "$PACKAGE" = "data_processing" ]; then
docker create -ti --name temp_container "fbpcs/data-processing:${TAG}"
docker cp temp_container:/usr/local/bin/sharder "$SCRIPT_DIR/binaries_out/."
docker cp temp_container:/usr/local/bin/sharder_hashed_for_pid "$SCRIPT_DIR/binaries_out/."
docker cp temp_container:/usr/local/bin/pid_preparer "$SCRIPT_DIR/binaries_out/."
docker cp temp_container:/usr/local/bin/lift_id_combiner "$SCRIPT_DIR/binaries_out/."
docker cp temp_container:/usr/local/bin/attribution_id_combiner "$SCRIPT_DIR/binaries_out/."
docker rm -f temp_container
fi