# Simplified single-stage build for SeaweedFS with FoundationDB support # Force x86_64 platform to use AMD64 FoundationDB packages FROM --platform=linux/amd64 golang:1.24-bookworm # Install system dependencies and FoundationDB RUN apt-get update && apt-get install -y \ build-essential \ wget \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # Install FoundationDB client libraries (x86_64 emulation) RUN echo "๐Ÿ—๏ธ Installing FoundationDB AMD64 package with x86_64 emulation..." \ && wget -q https://github.com/apple/foundationdb/releases/download/7.1.61/foundationdb-clients_7.1.61-1_amd64.deb \ && dpkg -i foundationdb-clients_7.1.61-1_amd64.deb \ && rm foundationdb-clients_7.1.61-1_amd64.deb \ && echo "๐Ÿ” Verifying FoundationDB installation..." \ && ls -la /usr/include/foundationdb/ \ && ls -la /usr/lib/*/libfdb_c* 2>/dev/null || echo "Library files:" \ && find /usr -name "libfdb_c*" -type f 2>/dev/null \ && ldconfig # Set up Go environment for CGO ENV CGO_ENABLED=1 ENV GOOS=linux ENV CGO_CFLAGS="-I/usr/include/foundationdb -I/usr/local/include/foundationdb -DFDB_API_VERSION=630" ENV CGO_LDFLAGS="-L/usr/lib -lfdb_c" # Create work directory WORKDIR /build # Copy source code COPY . . # Using Go 1.24 to match project requirements # Download dependencies (using versions from go.mod for deterministic builds) RUN go mod download # Build SeaweedFS with FoundationDB support RUN echo "๐Ÿ”จ Building SeaweedFS with FoundationDB support..." && \ echo "๐Ÿ” Debugging: Checking headers before build..." && \ find /usr -name "fdb_c.h" -type f 2>/dev/null || echo "No fdb_c.h found" && \ ls -la /usr/include/foundationdb/ 2>/dev/null || echo "No foundationdb include dir" && \ ls -la /usr/lib/libfdb_c* 2>/dev/null || echo "No libfdb_c libraries" && \ echo "CGO_CFLAGS: $CGO_CFLAGS" && \ echo "CGO_LDFLAGS: $CGO_LDFLAGS" && \ go build -tags foundationdb -ldflags="-w -s" -o weed ./weed && \ chmod +x weed && \ echo "โœ… Build successful!" && \ ./weed version # Test compilation (don't run tests as they need cluster) RUN echo "๐Ÿงช Compiling tests..." && \ go test -tags foundationdb -c -o fdb_store_test ./weed/filer/foundationdb/ && \ echo "โœ… Tests compiled successfully!" # Create runtime directories RUN mkdir -p /var/fdb/config /usr/local/bin # Copy binaries to final location RUN cp weed /usr/local/bin/weed && \ cp fdb_store_test /usr/local/bin/fdb_store_test # Default command CMD ["/usr/local/bin/weed", "version"]