forked from ethereum-optimism/optimism-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-local.sh
More file actions
executable file
·65 lines (56 loc) · 1.49 KB
/
build-local.sh
File metadata and controls
executable file
·65 lines (56 loc) · 1.49 KB
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
#!/bin/bash
# build-local.sh - build inside docker image
# for local development
# Copyright 2020 Optimism PBC
# MIT License
# This script uses docker-compose to manage the different
# commands and entrypoints for building the different services.
# The possible services are in docker-compose.local.yml
USAGE="
$ ./scripts/build-local.sh
Build docker images from git branches.
All images will be built if no service
is specificed.
CLI Arguments:
-s|--service - service to build
-h|--help - help message
"
# run all of the services except for the integration_tests
SERVICES=$(docker-compose -f docker-compose.build.yml config --services \
| tr '\n' ' ')
SERVICE=""
while (( "$#" )); do
case "$1" in
-s|--service)
if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
SERVICE="$2"
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-h|--help)
echo "$USAGE"
exit 0
;;
*)
echo "Unknown argument $1" >&2
shift
;;
esac
done
docker-compose -f docker-compose.build.yml down --remove-orphans
# Remove all volumes except for the go-modules volume
docker volume ls --format='{{.Name}}' \
| grep optimism-integration \
| grep -v go-modules \
| xargs docker volume rm -f \
> /dev/null 2>&1
if [ -z $SERVICE ]; then
for SERVICE in $SERVICES; do
docker-compose -f docker-compose.build.yml up $SERVICE
done
else
docker-compose -f docker-compose.build.yml up $SERVICE
fi