-
Notifications
You must be signed in to change notification settings - Fork 4
/
dev.sh
executable file
·49 lines (44 loc) · 1017 Bytes
/
dev.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
#!/usr/bin/env sh
set -e
dev_image=${DEV_IMAGE:-"nethsecurity-ui:dev-20.9.0"}
container_name=nethsecurity-ui-dev
build_image() {
podman build \
--force-rm \
--layers \
--target dev \
--tag "${dev_image}" \
.
}
if ! podman image exists "$dev_image"; then
build_image
fi
if [ "$#" -gt 0 ]; then
if [ "$1" = "build" ]; then
build_image
else
if podman container exists $container_name; then
podman exec \
--interactive \
--tty \
$container_name "$@"
else
podman run \
--rm \
--interactive \
--tty \
--volume "$(pwd)":/app:Z \
"${dev_image}" "$@"
fi
fi
else
podman run \
--name $container_name \
--replace \
--rm \
--interactive \
--tty \
--publish 5173:5173 \
--volume "$(pwd)":/app:Z \
"${dev_image}"
fi