🔧 ci: fix Dockerfile.prod to use proper dependency hash and add testing scripts
This commit is contained in:
20
scripts/calculate-deps-hash.sh
Executable file
20
scripts/calculate-deps-hash.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user