-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·44 lines (37 loc) · 801 Bytes
/
test.sh
File metadata and controls
executable file
·44 lines (37 loc) · 801 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
#!/bin/bash
#
SRC=$(realpath $(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd))
OUT=$SRC/out
TARGET=amd64
PORT=5000
VERSION=
IMAGE=docker.io/chromedp/headless-shell
OPTIND=1
while getopts "o:t:p:v:i:" opt; do
case "$opt" in
o) OUT=$OPTARG ;;
t) TARGET=$OPTARG ;;
p) PORT=$OPTARG ;;
v) VERSION=$OPTARG ;;
i) IMAGE=$OPTARG ;;
esac
done
# determine version
if [ -z "$VERSION" ]; then
VERSION=$(ls $OUT/*.bz2|sort -r -V|head -1|sed -e 's/.*headless-shell-\([0-9\.]\+\).*/\1/')
fi
NAME=$(basename $IMAGE)-$VERSION-$TARGET
(set -x;
podman run \
--name $NAME \
--platform linux/$TARGET \
--rm \
--detach \
--publish $PORT:9222 \
$IMAGE:$VERSION
)
sleep 3
curl -v --connect-timeout 20 --max-time 30 http://localhost:5000/json/version
(set -x;
podman stop $NAME
)