🐳 feat: implement Docker multi-stage build with caching optimization
Added Docker build infrastructure: - Multi-stage build (builder, cache, production) - Dependency hashing for cache invalidation - GNU tar support for cache compatibility - Production and development Dockerfiles - Docker Compose for local development Build Optimization: - Dependency-based cache keys - Layer caching strategy - Cross-platform compatibility - Gitea Actions cache integration Files Added: - docker/Dockerfile.build - Build environment - docker/Dockerfile.prod - Production image - docker/Dockerfile.prod.template - Template-based generation - docker-compose.yml - Development setup - scripts/calculate-deps-hash.sh - Cache key calculation - scripts/test-docker-cache.sh - Cache testing Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
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