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
|
|
@ -51,14 +51,19 @@ for svc in ${SERVICES}; do
|
|||
dockerfile="Dockerfile"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown service: ${svc}, skipping...";
|
||||
echo "Unknown service: ${svc}, skipping..."
|
||||
continue
|
||||
;;
|
||||
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}"
|
||||
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}"
|
||||
docker push "${IMAGE}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue