From b177e603da045b0f6b8546bbda2670849481bbb3 Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Mon, 16 Feb 2026 20:38:50 -0500 Subject: [PATCH] chore: update Docker build configuration --- build/docker/simple.Dockerfile | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/build/docker/simple.Dockerfile b/build/docker/simple.Dockerfile index 2092c13..fac9004 100644 --- a/build/docker/simple.Dockerfile +++ b/build/docker/simple.Dockerfile @@ -1,8 +1,8 @@ # Simple Dockerfile for homelab use FROM golang:1.25-alpine AS builder -# Install dependencies -RUN apk add --no-cache git make gcc musl-dev +# Install dependencies including C++ build tools +RUN apk add --no-cache git make gcc g++ musl-dev cmake # Set working directory WORKDIR /app @@ -16,15 +16,21 @@ RUN go mod download # Copy source code COPY . . -# Build Go binaries +# Copy and build native C++ libraries +COPY native/ ./native/ +RUN rm -rf native/build && cd native && mkdir -p build && cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) + +# Build Go binaries with native libs RUN CGO_ENABLED=1 go build -o bin/api-server cmd/api-server/main.go && \ CGO_ENABLED=1 go build -o bin/worker ./cmd/worker # Final stage FROM alpine:3.19 -# Install runtime dependencies -RUN apk add --no-cache bash ca-certificates redis openssl curl podman fuse-overlayfs slirp4netns iptables +# Install runtime dependencies including C++ stdlib +RUN apk add --no-cache bash ca-certificates redis openssl curl podman fuse-overlayfs slirp4netns iptables libstdc++ # Create app user RUN addgroup -g 1001 -S appgroup && \ @@ -33,8 +39,20 @@ RUN addgroup -g 1001 -S appgroup && \ # Set working directory WORKDIR /app -# Copy binaries from builder +# Copy binaries and native libs from builder COPY --from=builder /app/bin/ /usr/local/bin/ +RUN mkdir -p /usr/local/lib +COPY --from=builder /app/native/build/lib*.so /usr/local/lib/ + +# Create versioned symlinks expected by the binaries +RUN cd /usr/local/lib && \ + for lib in *.so; do \ + ln -sf "$lib" "${lib}.0" 2>/dev/null || true; \ + done + +# Update library cache and set library path +RUN ldconfig /usr/local/lib 2>/dev/null || true +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH # Copy configs and templates COPY --from=builder /app/configs/ /app/configs/