-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·54 lines (49 loc) · 995 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·54 lines (49 loc) · 995 Bytes
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
#!/bin/sh
set -eu
trimpath="-trimpath"
goproxy=""
skip_admin_ui=0
while [ "$#" -gt 0 ]; do
case "$1" in
--goproxy)
[ "$#" -ge 2 ] || { echo "--goproxy requires a value" >&2; exit 1; }
goproxy="$2"
shift 2
;;
--no-trimpath)
trimpath=""
shift
;;
--skip-admin-ui)
skip_admin_ui=1
shift
;;
-h|--help)
echo "Usage: $0 [--goproxy <value>] [--no-trimpath] [--skip-admin-ui]"
exit 0
;;
*)
echo "unknown option: $1" >&2
exit 1
;;
esac
done
if [ -n "$goproxy" ]; then
export GOPROXY="$goproxy"
fi
if [ "$skip_admin_ui" -eq 0 ] && [ -f internal/admin/web/package.json ]; then
if ! command -v npm >/dev/null 2>&1; then
echo "npm is required to build the admin UI; use --skip-admin-ui only when internal/admin/static is already built" >&2
exit 1
fi
(
cd internal/admin/web
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
npm run build
)
fi
go build $trimpath -ldflags="-s -w" -o apk-cache ./cmd/apk-cache