Files
artalkjs/scripts/docker-build.sh
T
qwqcode ca3d37fc2d fix(build): propagate image version metadata
Inject the requested release version and commit hash through Go linker variables so Docker images report the version they were built for, and make release preparation update the linkable version variable.\n\nAssert the version in release image smoke tests and trim unused files from Docker build contexts while preserving both prebuilt-UI and full frontend build paths.
2026-07-22 22:20:27 +08:00

23 lines
509 B
Bash
Executable File

#!/bin/bash
set -e
IMAGE_NAME="artalk/artalk-go"
VERSION=$(git describe --tags --abbrev=0 --match 'v*')
if [[ $* == *--push* ]]
then
# tag and push image
for tag in {${VERSION},latest}; do
docker image tag "${IMAGE_NAME}" "${IMAGE_NAME}:${tag}"
docker push "${IMAGE_NAME}:${tag}"
done
else
# build
docker image build \
--build-arg "APP_VERSION=${VERSION}" \
--build-arg "APP_COMMIT_HASH=$(git rev-parse HEAD)" \
-t "${IMAGE_NAME}" \
.
fi