feat: initial version with start+stop+build

This commit is contained in:
Marc 2024-04-08 19:38:48 -04:00
parent 03c595bed0
commit 92155092a5
Signed by: marc
GPG key ID: 048E042F22B5DC79
6 changed files with 55 additions and 0 deletions

5
Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM registry:2
ENV REGISTRY_AUTH="htpasswd"
ENV REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm"
ENV REGISTRY_AUTH_HTPASSWD_PATH="/auth/htpasswd"

View file

@ -1,3 +1,9 @@
# Registry # Registry
Private container registry to organize self-hosted services. Private container registry to organize self-hosted services.
## Setting up service credentials
The `container-registry_auth` volume is pre-seeded with an empty `htpasswd` file that will hold the credentials for registry users.
See `man htpasswd` for reference.

8
build.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
image_name=$(jq .service_name ./service.json -r)
image_version=0
podman build \
-t "$image_name:$image_version" \
.

3
service.json Normal file
View file

@ -0,0 +1,3 @@
{
"service_name": "container-registry"
}

30
start.sh Executable file
View file

@ -0,0 +1,30 @@
#!/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"

3
stop.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
podman pod stop "$(jq .service_name ./service.json -r)"