feat: add image description label with commit info in build_and_push_ghcr.sh
This commit is contained in:
parent
ec377438cf
commit
262cf0cbb4
1 changed files with 22 additions and 17 deletions
|
|
@ -38,27 +38,32 @@ fi
|
||||||
|
|
||||||
for svc in ${SERVICES}; do
|
for svc in ${SERVICES}; do
|
||||||
case "${svc}" in
|
case "${svc}" in
|
||||||
db)
|
db)
|
||||||
ctx="./apps/db"
|
ctx="./apps/db"
|
||||||
dockerfile="Dockerfile"
|
dockerfile="Dockerfile"
|
||||||
;;
|
;;
|
||||||
backend)
|
backend)
|
||||||
ctx="./apps/backend"
|
ctx="./apps/backend"
|
||||||
dockerfile="Dockerfile"
|
dockerfile="Dockerfile"
|
||||||
;;
|
;;
|
||||||
web)
|
web)
|
||||||
ctx="./apps/infoalloggi"
|
ctx="./apps/infoalloggi"
|
||||||
dockerfile="Dockerfile"
|
dockerfile="Dockerfile"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown service: ${svc}, skipping...";
|
echo "Unknown service: ${svc}, skipping..."
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Get last git commit info
|
||||||
|
GIT_COMMIT_ID=$(git rev-parse --short HEAD)
|
||||||
|
GIT_COMMIT_MSG=$(git log -1 --pretty=%B | tr -d '\n')
|
||||||
|
DESCRIPTION="Commit: ${GIT_COMMIT_ID} - ${GIT_COMMIT_MSG}"
|
||||||
|
|
||||||
IMAGE="${IMAGE_REGISTRY}/${OWNER}/${PREFIX}-${svc}:${TAG}"
|
IMAGE="${IMAGE_REGISTRY}/${OWNER}/${PREFIX}-${svc}:${TAG}"
|
||||||
echo "Building ${PREFIX}-${svc} -> ${IMAGE} (context: ${ctx})"
|
echo "Building ${PREFIX}-${svc} -> ${IMAGE} (context: ${ctx})"
|
||||||
docker build --build-arg ENV_FILE="${ENV_FILE}" -t "${IMAGE}" -f "$ctx/$dockerfile" "$ctx"
|
docker build --build-arg ENV_FILE="${ENV_FILE}" -t "${IMAGE}" --label "org.opencontainers.image.description=${DESCRIPTION}" -f "$ctx/$dockerfile" "$ctx"
|
||||||
|
|
||||||
echo "Pushing ${IMAGE}"
|
echo "Pushing ${IMAGE}"
|
||||||
docker push "${IMAGE}"
|
docker push "${IMAGE}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue