Update Dockerfile and docker-compose.yml to use port 80; add publish script for image management
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
image="gitea.faerro.it/andrea/faerro-kb"
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "Docker is required to build and publish the image." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v git >/dev/null 2>&1; then
|
||||
echo "Git is required to determine the release version." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tag="$(git -C "$repo_root" describe --tags --exact-match HEAD 2>/dev/null || true)"
|
||||
version="${tag#v}"
|
||||
|
||||
if [[ ! "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
|
||||
echo "The checked-out commit must have a SemVer tag (for example, 0.0.2 or v0.0.2)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$repo_root"
|
||||
docker build --tag "$image:$version" --tag "$image:latest" .
|
||||
docker push "$image:$version"
|
||||
docker push "$image:latest"
|
||||
|
||||
echo "Published $image:$version and $image:latest"
|
||||
Reference in New Issue
Block a user