31 lines
730 B
Bash
31 lines
730 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
service_name=$(jq .service_name ./service.json -r)
|
||
|
image_name=$service_name
|
||
|
image_version=0
|
||
|
|
||
|
auth_volume="$service_name"_auth
|
||
|
|
||
|
podman volume exists "$auth_volume"
|
||
|
|
||
|
if [[ "$?" != "1" ]]; then
|
||
|
echo "Volume $auth_volume already exists."
|
||
|
else
|
||
|
podman volume create "$auth_volume"
|
||
|
htpasswd_parent=$(podman volume inspect "$auth_volume" | jq '.[0].Mountpoint' -r)
|
||
|
touch "$htpasswd_parent"/htpasswd
|
||
|
echo "Created volume $auth_volume and seeded with empty htpasswd."
|
||
|
fi
|
||
|
|
||
|
podman pod create \
|
||
|
--name "$service_name" \
|
||
|
--replace \
|
||
|
-p 5000:5000 \
|
||
|
|
||
|
podman run \
|
||
|
-td \
|
||
|
--pod "$service_name" \
|
||
|
--name "$service_name"_app \
|
||
|
-v "$auth_volume":/auth:ro \
|
||
|
"$image_name:$image_version"
|