Files
dance-lessons-coach/scripts/calculate-deps-hash.sh
Gabriel Radureau edd08b4e1c
Some checks failed
CI/CD Pipeline / Build Docker Cache (push) Successful in 26s
CI/CD Pipeline / CI Pipeline (push) Failing after 58s
🔧 ci: fix Dockerfile.prod to use proper dependency hash and add testing scripts
2026-04-07 12:12:22 +02:00

20 lines
613 B
Bash
Executable File

#!/bin/bash
# Calculate dependency hash for Docker cache tag
# This script calculates the hash used for the build cache image tag
# Calculate hash of go.mod + go.sum
# Use shasum on macOS, sha256sum on Linux
if command -v sha256sum >/dev/null 2>&1; then
DEPS_HASH=$(sha256sum go.mod go.sum | sha256sum | cut -d' ' -f1 | head -c 12)
else
DEPS_HASH=$(shasum -a 256 go.mod go.sum | shasum -a 256 | cut -d' ' -f1 | head -c 12)
fi
echo "Dependency hash: $DEPS_HASH"
echo "$DEPS_HASH"
# Export for use in other scripts
if [ -n "$1" ]; then
echo "DEPS_HASH=$DEPS_HASH" > "$1"
echo "Exported to: $1"
fi