TEST: Full Claude reword
This commit is contained in:
		| @@ -36,34 +36,32 @@ COPY --chown=builder:builder . /home/builder/zabbix/ | ||||
|  | ||||
| WORKDIR /home/builder/zabbix | ||||
|  | ||||
| # Create build script | ||||
| # Create build script that just builds packages | ||||
| USER root | ||||
| RUN cat > /usr/local/bin/build-and-copy.sh << 'EOF' | ||||
| RUN cat > /usr/local/bin/build-packages.sh << 'EOF' | ||||
| #!/bin/sh | ||||
| set -e | ||||
|  | ||||
| echo "Building packages as builder user..." | ||||
| sudo -u builder sh -c " | ||||
|     cd /home/builder/zabbix | ||||
|     echo 'Generating checksums...' | ||||
|     abuild checksum | ||||
|     echo 'Building packages...' | ||||
|     abuild -r | ||||
| " | ||||
|  | ||||
| echo "Copying packages to output..." | ||||
| find /home/builder/packages -name '*.apk' -exec cp {} /output/ \; | ||||
| echo "Build complete! Packages built in /home/builder/packages:" | ||||
| find /home/builder/packages -name "*.apk" -exec ls -la {} \; | ||||
|  | ||||
| # Make files readable and writable by everyone (fixes permission issues) | ||||
| chmod 666 /output/*.apk 2>/dev/null || true | ||||
| echo "Setting proper permissions on packages..." | ||||
| chmod 644 /home/builder/packages/*.apk 2>/dev/null || true | ||||
|  | ||||
| # Also try changing ownership to a generic user ID that should work | ||||
| # Use UID 1000 which is common for CI runners | ||||
| chown 1000:1000 /output/*.apk 2>/dev/null || true | ||||
|  | ||||
| echo "Build complete! Packages:" | ||||
| ls -la /output/ | ||||
| echo "Final package list (excluding APKINDEX):" | ||||
| find /home/builder/packages -name "*.apk" -exec ls -la {} \; | ||||
| EOF | ||||
|  | ||||
| RUN chmod +x /usr/local/bin/build-and-copy.sh | ||||
| RUN chmod +x /usr/local/bin/build-packages.sh | ||||
|  | ||||
| # Set build command | ||||
| CMD ["/usr/local/bin/build-and-copy.sh"] | ||||
| CMD ["/usr/local/bin/build-packages.sh"] | ||||
| @@ -12,29 +12,46 @@ echo "=== Zabbix APK Builder ===" | ||||
| echo "Project directory: $PROJECT_DIR" | ||||
| echo "Output directory: $OUTPUT_DIR" | ||||
|  | ||||
| # Clean up any existing containers | ||||
| # Clean up function | ||||
| cleanup() { | ||||
|     echo "Cleaning up..." | ||||
|     docker rm -f "$CONTAINER_NAME" 2>/dev/null || true | ||||
|     echo "Cleaning up container..." | ||||
|     docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true | ||||
| } | ||||
|  | ||||
| trap cleanup EXIT | ||||
|  | ||||
| # Create output directory | ||||
| # Clean and create output directory | ||||
| rm -rf "$OUTPUT_DIR" | ||||
| mkdir -p "$OUTPUT_DIR" | ||||
|  | ||||
| # Build Docker image | ||||
| echo "Building Docker image..." | ||||
| docker build -t "$IMAGE_NAME" "$PROJECT_DIR" | ||||
|  | ||||
| # Run the build in container | ||||
| echo "Running package build..." | ||||
| docker run --rm \ | ||||
|     --name "$CONTAINER_NAME" \ | ||||
|     -v "$OUTPUT_DIR:/output" \ | ||||
|     "$IMAGE_NAME" | ||||
| # Run the build in the container | ||||
| echo "Running package build in container..." | ||||
| docker run --name "$CONTAINER_NAME" "$IMAGE_NAME" | ||||
|  | ||||
| echo "Build completed successfully!" | ||||
| echo "To install packages:" | ||||
| echo "  apk add --allow-untrusted $OUTPUT_DIR/zabbix-agent-*.apk" | ||||
| echo "  apk add --allow-untrusted $OUTPUT_DIR/zabbix-proxy-*.apk" | ||||
| # Copy packages from container to host | ||||
| echo "Copying packages from container..." | ||||
| if docker cp "$CONTAINER_NAME:/home/builder/packages/." "$OUTPUT_DIR/"; then | ||||
|     echo "✅ Packages copied successfully" | ||||
|      | ||||
|     # Remove APKINDEX files (we only want the .apk packages) | ||||
|     echo "Removing repository index files..." | ||||
|     find "$OUTPUT_DIR" -name "APKINDEX.tar.gz" -delete 2>/dev/null || true | ||||
|      | ||||
|     # Fix permissions on copied files | ||||
|     echo "Fixing file permissions..." | ||||
|     find "$OUTPUT_DIR" -name "*.apk" -exec chmod 644 {} \; 2>/dev/null || true | ||||
|      | ||||
|     echo "Build completed successfully!" | ||||
|     echo "Packages are in $OUTPUT_DIR:" | ||||
|     find "$OUTPUT_DIR" -name "*.apk" -exec ls -la {} \; | ||||
| else | ||||
|     echo "❌ Failed to copy packages" | ||||
|     echo "Checking what's in the container..." | ||||
|     docker exec "$CONTAINER_NAME" find /home/builder -name "*.apk" -exec ls -la {} \; 2>/dev/null || true | ||||
|     docker exec "$CONTAINER_NAME" ls -la /home/builder/packages/ 2>/dev/null || true | ||||
|     exit 1 | ||||
| fi | ||||
		Reference in New Issue
	
	Block a user