v0.7.9 - Optimize Docker build caching and enforce static binary usage
- Restructure Dockerfile.alpine-musl for better layer caching * Build dependencies (secp256k1, libwebsockets) in separate cached layers * Copy submodules before source files to maximize cache hits * Reduce rebuild time from ~2-3 minutes to ~10-15 seconds for source changes - Remove 'musl' from binary names (c_relay_static_x86_64 instead of c_relay_static_musl_x86_64) - Enforce static binary usage in make_and_restart_relay.sh * Remove all fallbacks to regular make builds * Exit with clear error if static binary not found * Ensures JSON1 extension is always available - Fix build_static.sh hanging on ldd check with timeout - Remove sudo usage from build_static.sh (assumes docker group membership) These changes ensure consistent builds with JSON1 support and dramatically improve development iteration speed through intelligent Docker layer caching.
This commit is contained in:
@@ -53,17 +53,17 @@ ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
PLATFORM="linux/amd64"
|
||||
OUTPUT_NAME="c_relay_static_musl_x86_64"
|
||||
OUTPUT_NAME="c_relay_static_x86_64"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
PLATFORM="linux/arm64"
|
||||
OUTPUT_NAME="c_relay_static_musl_arm64"
|
||||
OUTPUT_NAME="c_relay_static_arm64"
|
||||
;;
|
||||
*)
|
||||
echo "WARNING: Unknown architecture: $ARCH"
|
||||
echo "Defaulting to linux/amd64"
|
||||
PLATFORM="linux/amd64"
|
||||
OUTPUT_NAME="c_relay_static_musl_${ARCH}"
|
||||
OUTPUT_NAME="c_relay_static_${ARCH}"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -107,14 +107,14 @@ $DOCKER_CMD build \
|
||||
--platform "$PLATFORM" \
|
||||
--target builder \
|
||||
-f "$DOCKERFILE" \
|
||||
-t c-relay-musl-builder-stage:latest \
|
||||
-t c-relay-static-builder-stage:latest \
|
||||
. > /dev/null 2>&1
|
||||
|
||||
# Create a temporary container to copy the binary
|
||||
CONTAINER_ID=$($DOCKER_CMD create c-relay-musl-builder-stage:latest)
|
||||
CONTAINER_ID=$($DOCKER_CMD create c-relay-static-builder-stage:latest)
|
||||
|
||||
# Copy binary from container
|
||||
$DOCKER_CMD cp "$CONTAINER_ID:/build/c_relay_static_musl" "$BUILD_DIR/$OUTPUT_NAME" || {
|
||||
$DOCKER_CMD cp "$CONTAINER_ID:/build/c_relay_static" "$BUILD_DIR/$OUTPUT_NAME" || {
|
||||
echo "ERROR: Failed to extract binary from container"
|
||||
$DOCKER_CMD rm "$CONTAINER_ID" 2>/dev/null
|
||||
exit 1
|
||||
@@ -180,7 +180,7 @@ echo "Binary: $BUILD_DIR/$OUTPUT_NAME"
|
||||
echo "Size: $(du -h "$BUILD_DIR/$OUTPUT_NAME" | cut -f1)"
|
||||
echo "Platform: $PLATFORM"
|
||||
if [ "$TRULY_STATIC" = true ]; then
|
||||
echo "Type: Fully static MUSL binary"
|
||||
echo "Type: Fully static binary (Alpine MUSL-based)"
|
||||
echo "Portability: Works on ANY Linux distribution"
|
||||
else
|
||||
echo "Type: Static binary (may have minimal dependencies)"
|
||||
|
||||
Reference in New Issue
Block a user