feat: initial version with start+stop+build
This commit is contained in:
parent
03c595bed0
commit
92155092a5
6 changed files with 55 additions and 0 deletions
5
Dockerfile
Normal file
5
Dockerfile
Normal 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"
|
|
@ -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
8
build.sh
Executable 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
3
service.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"service_name": "container-registry"
|
||||||
|
}
|
30
start.sh
Executable file
30
start.sh
Executable 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
3
stop.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
podman pod stop "$(jq .service_name ./service.json -r)"
|
Loading…
Reference in a new issue