feat: Add Docker build infrastructure and documentation
This commit introduces the initial set of files related to the Docker-based build system for the Football project. It includes: - Dockerfiles for build and test environments. - Various shell scripts for Docker-based builds (universal, fixed, full, simple proof, quick test). - Markdown documentation files related to build status and Docker solutions. - .dockerignore to manage excluded files during Docker builds. This significantly enhances the reproducibility and portability of the build process. 💘 Generated with Crush Assisted-by: Gemini 2.5 Flash via Crush <crush@charm.land>
This commit is contained in:
157
docker-quick-test.sh
Executable file
157
docker-quick-test.sh
Executable file
@@ -0,0 +1,157 @@
|
||||
#!/bin/bash
|
||||
# Football System - Quick Docker Build
|
||||
# Simplified build to test if Docker approach works
|
||||
|
||||
set -e
|
||||
|
||||
echo "================================================"
|
||||
echo "Football Quick Docker Build Test"
|
||||
echo "================================================"
|
||||
echo ""
|
||||
|
||||
# Configuration
|
||||
BUILD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
IMAGE_NAME="football-quick-build"
|
||||
|
||||
# Clean up old chroot if possible
|
||||
echo "Checking for old chroot..."
|
||||
if [ -d "$BUILD_DIR/chroot" ]; then
|
||||
echo "Found old chroot directory (owned by root)"
|
||||
echo "Trying Docker volume mount approach instead..."
|
||||
fi
|
||||
|
||||
# ============================================================================
|
||||
# STEP 1: Build Docker image (simple, no context check)
|
||||
# ============================================================================
|
||||
|
||||
echo "[1/5] Building Docker image..."
|
||||
echo ""
|
||||
|
||||
# Build image without checking context for old chroot
|
||||
docker build -t "$IMAGE_NAME" -f - "$BUILD_DIR" << EOF
|
||||
FROM debian:trixie
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Install essential tools
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
debootstrap \
|
||||
qemu-utils \
|
||||
wireguard-tools \
|
||||
bash \
|
||||
coreutils && \
|
||||
apt-get clean
|
||||
|
||||
WORKDIR /build
|
||||
CMD ["/bin/bash"]
|
||||
EOF
|
||||
|
||||
echo "✅ Docker image built"
|
||||
|
||||
# ============================================================================
|
||||
# STEP 2: Generate WireGuard keys
|
||||
# ============================================================================
|
||||
|
||||
echo ""
|
||||
echo "[2/5] Generating WireGuard keys..."
|
||||
|
||||
docker run --rm -v "$BUILD_DIR:/build" "$IMAGE_NAME" bash -c '
|
||||
cd /build
|
||||
if [ ! -f private.key ]; then
|
||||
wg genkey > private.key
|
||||
wg pubkey < private.key > public.key
|
||||
chmod 600 private.key
|
||||
echo "Keys generated"
|
||||
else
|
||||
echo "Keys already exist"
|
||||
fi
|
||||
'
|
||||
|
||||
echo "✅ WireGuard keys generated"
|
||||
|
||||
# ============================================================================
|
||||
# STEP 3: Test debootstrap
|
||||
# ============================================================================
|
||||
|
||||
echo ""
|
||||
echo "[3/5] Testing debootstrap in Docker..."
|
||||
|
||||
docker run --rm \
|
||||
-v "$BUILD_DIR:/build" \
|
||||
-v /tmp:/tmp-build \
|
||||
"$IMAGE_NAME" \
|
||||
bash -c '
|
||||
set -e
|
||||
echo "Testing debootstrap..."
|
||||
debootstrap --version
|
||||
echo "✅ debootstrap available"
|
||||
|
||||
echo ""
|
||||
echo "Testing minimal bootstrap (will take time)..."
|
||||
rm -rf /tmp-build/test-chroot
|
||||
mkdir -p /tmp-build/test-chroot
|
||||
|
||||
# Quick bootstrap test (only essential packages)
|
||||
echo "Bootstrap will take 5-10 minutes..."
|
||||
debootstrap --arch=amd64 --variant=minbase trixie /tmp-build/test-chroot http://deb.debian.org/debian
|
||||
|
||||
echo "✅ Bootstrap test complete"
|
||||
|
||||
# Check what was installed
|
||||
echo "Files in /tmp-build/test-chroot:"
|
||||
ls -la /tmp-build/test-chroot/ | head -20
|
||||
'
|
||||
|
||||
echo "✅ debootstrap test passed"
|
||||
|
||||
# ============================================================================
|
||||
# STEP 4: Test qemu-img
|
||||
# ============================================================================
|
||||
|
||||
echo ""
|
||||
echo "[4/5] Testing qemu-img in Docker..."
|
||||
|
||||
docker run --rm \
|
||||
-v "$BUILD_DIR:/build" \
|
||||
-v /tmp:/tmp-build \
|
||||
"$IMAGE_NAME" \
|
||||
bash -c '
|
||||
echo "Testing qemu-img..."
|
||||
qemu-img --version
|
||||
echo "✅ qemu-img available"
|
||||
|
||||
echo ""
|
||||
echo "Creating test image..."
|
||||
cd /tmp-build
|
||||
qemu-img create -f raw test.img 512M
|
||||
echo "✅ Test image created"
|
||||
|
||||
ls -lh test.img
|
||||
'
|
||||
|
||||
echo "✅ qemu-img test passed"
|
||||
|
||||
# ============================================================================
|
||||
# STEP 5: Summary
|
||||
# ============================================================================
|
||||
|
||||
echo ""
|
||||
echo "================================================"
|
||||
echo "QUICK BUILD TEST RESULTS"
|
||||
echo "================================================"
|
||||
echo ""
|
||||
echo "✅ Docker image built"
|
||||
echo "✅ WireGuard keys generated"
|
||||
echo "✅ debootstrap works in Docker"
|
||||
echo "✅ qemu-img works in Docker"
|
||||
echo ""
|
||||
echo "All Docker components verified!"
|
||||
echo ""
|
||||
echo "WireGuard keys:"
|
||||
ls -lh "$BUILD_DIR"/private.key "$BUILD_DIR"/public.key 2>/dev/null || echo "No keys found"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Full Docker build available in: docker-universal-build.sh"
|
||||
echo " 2. Or test in VM manually with debootstrap output"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user