registry/start.sh
Marc Cataford 019188cd37
All checks were successful
/ test (push) Successful in 38s
feat: allow specifying image version when starting
2024-04-09 00:16:05 -04:00

42 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
service_name=$(jq .service_name ./service.json -r)
image_name=$service_name
image_version=${IMAGE_VERSION:-local}
auth_volume="$service_name"_auth
data_volume="$service_name"_data
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 volume exists "$data_volume"
if [[ "$?" != "1" ]]; then
echo "Volume $data_volume already exists."
else
podman volume create "$data_volume"
htpasswd_parent=$(podman volume inspect "$data_volume" | jq '.[0].Mountpoint' -r)
echo "Created volume $data_volume."
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 \
-v "$data_volume":/var/lib/registry \
"$image_name:$image_version"