chore: update Docker build configuration

This commit is contained in:
Jeremie Fraeys 2026-02-16 20:38:50 -05:00
parent 6cc02b5efc
commit b177e603da
No known key found for this signature in database

View file

@ -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/