# Build stage FROM gcc:14 AS builder WORKDIR /app # Copy source code COPY src ./src # Build shared library RUN gcc -shared -fPIC -O3 -o libboc_ipc.so src/ipc.c \ -lpthread -lrt # Build static library RUN gcc -c -O3 -o ipc.o src/ipc.c && \ ar rcs libboc_ipc.a ipc.o # Final stage - minimal runtime FROM alpine:latest RUN apk add --no-cache libc6-compat WORKDIR /app # Copy libraries COPY --from=builder /app/libboc_ipc.so /usr/local/lib/ COPY --from=builder /app/libboc_ipc.a /usr/local/lib/ COPY --from=builder /app/src/ipc.h /usr/local/include/ # Update library cache RUN ldconfig /usr/local/lib || true # Default command - keep container running for IPC CMD ["sh", "-c", "echo 'BOC C Runtime ready' && tail -f /dev/null"]