-
Notifications
You must be signed in to change notification settings - Fork 1
/
dev
executable file
·38 lines (35 loc) · 935 Bytes
/
dev
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
#!/bin/bash
set -euf
# print all commands if ci
if [[ -n ${CI:-} ]]; then
set -x
fi
DOCKER_IMAGE_NAME="${DOCKER_IMAGE_NAME:-dns-test:latest}"
case "${1:-}" in
"fmt")
find . -not -path '*/\.*' -type f -name '*.py' -exec \
yapf -i --style .style.yapf -p -vv {} '+' || true
;;
"run")
exec python3 -O ./dns-test.py ${@:2}
;;
"docker-build")
exec docker build -t "${DOCKER_IMAGE_NAME}" --cache-from "${DOCKER_IMAGE_NAME}" .
;;
"docker-push")
exec docker push "${DOCKER_IMAGE_NAME}"
;;
"docker-run")
exec docker run --rm -t \
--user "$(id -u):$(id -g)" \
-v "$(pwd):/workdir:rw" \
"${DOCKER_IMAGE_NAME}" ${@:2}
;;
"download-umbrella")
cd domains
wget -O- 'http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip' | gunzip >umbrella.csv
;;
*)
echo "usage: ${0} <fmt|docker-build|docker-run|docker-push|download-umbrella>"
;;
esac