enhance: make milvus image with asan available (#37050)

issue: #35854

Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
Zhen Ye 2024-10-24 10:05:29 +08:00 committed by GitHub
parent 49b562207c
commit f07aa72589
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 8 deletions

View File

@ -28,8 +28,8 @@ ifdef disk_index
endif endif
use_asan = OFF use_asan = OFF
ifdef USE_ASAN ifeq ($(USE_ASAN), ON)
use_asan =${USE_ASAN} use_asan = ${USE_ASAN}
CGO_LDFLAGS := $(shell go env CGO_LDFLAGS) -fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address CGO_LDFLAGS := $(shell go env CGO_LDFLAGS) -fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address
CGO_CFLAGS := $(shell go env CGO_CFLAGS) -fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address CGO_CFLAGS := $(shell go env CGO_CFLAGS) -fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address
MILVUS_GO_BUILD_TAGS := $(MILVUS_GO_BUILD_TAGS),use_asan MILVUS_GO_BUILD_TAGS := $(MILVUS_GO_BUILD_TAGS),use_asan
@ -384,12 +384,12 @@ codecov-cpp: build-cpp-with-coverage
# Build each component and install binary to $GOPATH/bin. # Build each component and install binary to $GOPATH/bin.
install: milvus install: milvus
@echo "Installing binary to './bin'" @echo "Installing binary to './bin'"
@(env USE_ASAN=$(USE_ASAN) GOPATH=$(GOPATH) LIBRARY_PATH=$(LIBRARY_PATH) bash $(PWD)/scripts/install_milvus.sh) @(env GOPATH=$(GOPATH) LIBRARY_PATH=$(LIBRARY_PATH) bash $(PWD)/scripts/install_milvus.sh)
@echo "Installation successful." @echo "Installation successful."
gpu-install: milvus-gpu gpu-install: milvus-gpu
@echo "Installing binary to './bin'" @echo "Installing binary to './bin'"
@(env USE_ASAN=$(USE_ASAN) GOPATH=$(GOPATH) LIBRARY_PATH=$(LIBRARY_PATH) bash $(PWD)/scripts/install_milvus.sh) @(env GOPATH=$(GOPATH) LIBRARY_PATH=$(LIBRARY_PATH) bash $(PWD)/scripts/install_milvus.sh)
@echo "Installation successful." @echo "Installation successful."
clean: clean:

View File

@ -12,6 +12,7 @@
FROM amazonlinux:2023 FROM amazonlinux:2023
ARG TARGETARCH ARG TARGETARCH
ARG MILVUS_ASAN_LIB
RUN yum install -y wget libgomp libaio libatomic openblas-devel && \ RUN yum install -y wget libgomp libaio libatomic openblas-devel && \
rm -rf /var/cache/yum/* rm -rf /var/cache/yum/*
@ -29,7 +30,7 @@ COPY --chown=root:root --chmod=774 ./lib/ /milvus/lib/
ENV PATH=/milvus/bin:$PATH ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so ENV LD_PRELOAD=${MILVUS_ASAN_LIB}:/milvus/lib/libjemalloc.so
ENV MALLOC_CONF=background_thread:true ENV MALLOC_CONF=background_thread:true
ENTRYPOINT ["/tini", "--"] ENTRYPOINT ["/tini", "--"]

View File

@ -13,6 +13,7 @@
FROM rockylinux/rockylinux:8 FROM rockylinux/rockylinux:8
ARG TARGETARCH ARG TARGETARCH
ARG MILVUS_ASAN_LIB
RUN dnf install -y wget libgomp libaio libatomic RUN dnf install -y wget libgomp libaio libatomic
@ -33,7 +34,7 @@ COPY ./lib/ /milvus/lib/
ENV PATH=/milvus/bin:$PATH ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so ENV LD_PRELOAD=${MILVUS_ASAN_LIB}:/milvus/lib/libjemalloc.so
ENV MALLOC_CONF=background_thread:true ENV MALLOC_CONF=background_thread:true
ENTRYPOINT ["/tini", "--"] ENTRYPOINT ["/tini", "--"]

View File

@ -12,6 +12,7 @@
FROM ubuntu:focal-20240530 FROM ubuntu:focal-20240530
ARG TARGETARCH ARG TARGETARCH
ARG MILVUS_ASAN_LIB
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends curl ca-certificates libaio-dev libgomp1 libopenblas-dev && \ apt-get install -y --no-install-recommends curl ca-certificates libaio-dev libgomp1 libopenblas-dev && \
@ -30,7 +31,7 @@ COPY --chown=root:root --chmod=774 ./lib/ /milvus/lib/
ENV PATH=/milvus/bin:$PATH ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so ENV LD_PRELOAD=${MILVUS_ASAN_LIB}:/milvus/lib/libjemalloc.so
ENV MALLOC_CONF=background_thread:true ENV MALLOC_CONF=background_thread:true
ENTRYPOINT ["/tini", "--"] ENTRYPOINT ["/tini", "--"]

View File

@ -12,6 +12,7 @@
FROM ubuntu:jammy-20240530 FROM ubuntu:jammy-20240530
ARG TARGETARCH ARG TARGETARCH
ARG MILVUS_ASAN_LIB
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends curl ca-certificates libaio-dev libgomp1 libopenblas-dev && \ apt-get install -y --no-install-recommends curl ca-certificates libaio-dev libgomp1 libopenblas-dev && \
@ -30,7 +31,7 @@ COPY --chown=root:root --chmod=774 ./lib/ /milvus/lib/
ENV PATH=/milvus/bin:$PATH ENV PATH=/milvus/bin:$PATH
ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib ENV LD_LIBRARY_PATH=/milvus/lib:$LD_LIBRARY_PATH:/usr/lib
ENV LD_PRELOAD=/milvus/lib/libjemalloc.so ENV LD_PRELOAD=${MILVUS_ASAN_LIB}:/milvus/lib/libjemalloc.so
ENV MALLOC_CONF=background_thread:true ENV MALLOC_CONF=background_thread:true
ENTRYPOINT ["/tini", "--"] ENTRYPOINT ["/tini", "--"]