Enhance version management and Docker build system

- Add Docker build args for proper version detection in containers
- Update build.sh script with smart version detection for Docker builds
- Add --message option to new-version.js for custom commit messages
- Fix Docker builds showing incorrect '-dev' suffix for release builds
- Improve versioning workflow with comprehensive --check analysis
This commit is contained in:
2026-01-21 21:48:45 +01:00
parent 4d6efe791b
commit d027459678
4 changed files with 65 additions and 15 deletions

View File

@@ -33,7 +33,31 @@ npm run build
# Optional container build with Docker
if command -v docker &> /dev/null; then
echo "🐳 Building Docker container (optional)..."
docker build -t jmespath-playground .
# Determine version information for Docker build
VERSION=$(git tag --points-at HEAD 2>/dev/null | sed 's/^v//' | head -n 1)
if [ -n "$VERSION" ]; then
# We're at a tagged commit - release build
echo "📦 Building release version: $VERSION"
docker build \
--build-arg VERSION="$VERSION" \
--build-arg IS_RELEASE="true" \
-t jmespath-playground:$VERSION \
-t jmespath-playground:latest .
echo "✅ Built Docker images: jmespath-playground:$VERSION, jmespath-playground:latest"
else
# Development build
PACKAGE_VERSION=$(grep '"version"' package.json | cut -d'"' -f4)
DEV_VERSION="${PACKAGE_VERSION}-dev"
echo "📦 Building development version: $DEV_VERSION"
docker build \
--build-arg VERSION="$DEV_VERSION" \
--build-arg IS_RELEASE="false" \
-t jmespath-playground:dev \
-t jmespath-playground:latest .
echo "✅ Built Docker images: jmespath-playground:dev, jmespath-playground:latest"
fi
else
echo "💡 Docker not found. Container build is optional."
echo " Install Docker if you want to build containers."
@@ -42,8 +66,13 @@ fi
echo "✅ Build completed successfully!"
echo ""
echo "To run the application:"
echo " npm run serve # Serve production build locally"
echo " docker run -p 3000:3000 jmespath-playground # Run container (if built)"
echo " npm run server # Run integrated server locally"
if command -v docker &> /dev/null; then
echo " docker run -p 3000:3000 jmespath-playground # Run with Docker"
VERSION=$(git tag --points-at HEAD 2>/dev/null | sed 's/^v//' | head -n 1)
if [ -n "$VERSION" ]; then
echo " docker run -p 3000:3000 jmespath-playground:$VERSION # Run release container"
else
echo " docker run -p 3000:3000 jmespath-playground:dev # Run dev container"
fi
echo " docker run -p 3000:3000 jmespath-playground:latest # Run latest container"
fi