feat: add volume for registry persistence
All checks were successful
/ test (push) Successful in 50s

This commit is contained in:
Marc 2024-04-09 00:02:12 -04:00
parent a778f82a41
commit 484f9931d2
Signed by: marc
GPG key ID: 048E042F22B5DC79
2 changed files with 13 additions and 1 deletions

View file

@ -18,4 +18,4 @@ jobs:
- name: Authenticate with registry - name: Authenticate with registry
run: podman login -u srv_container-registry -p ${{ secrets.REGISTRY_TOKEN }} ${{ env.CONTAINER_ADDRESS }} run: podman login -u srv_container-registry -p ${{ secrets.REGISTRY_TOKEN }} ${{ env.CONTAINER_ADDRESS }}
- name: Push image - name: Push image
run: podman push container-registry:0 ${{ env.CONTAINER_ADDRESS }}/container-registry:0 run: podman push container-registry:0 ${{ env.CONTAINER_ADDRESS }}/container-registry:${{ env.GITHUB_REF_NAME }}

View file

@ -5,6 +5,7 @@ image_name=$service_name
image_version=0 image_version=0
auth_volume="$service_name"_auth auth_volume="$service_name"_auth
data_volume="$service_name"_data
podman volume exists "$auth_volume" podman volume exists "$auth_volume"
@ -17,6 +18,16 @@ else
echo "Created volume $auth_volume and seeded with empty htpasswd." echo "Created volume $auth_volume and seeded with empty htpasswd."
fi 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 \ podman pod create \
--name "$service_name" \ --name "$service_name" \
--replace \ --replace \
@ -27,4 +38,5 @@ podman run \
--pod "$service_name" \ --pod "$service_name" \
--name "$service_name"_app \ --name "$service_name"_app \
-v "$auth_volume":/auth:ro \ -v "$auth_volume":/auth:ro \
-v "$data_volume":/var/lib/registry \
"$image_name:$image_version" "$image_name:$image_version"