fix: always install OpenBLAS and Stable Diffusion requirements

This commit is contained in:
Sébastien Prud'homme 2023-05-29 21:14:09 +02:00
parent a7fe65a54c
commit 65809f303e
2 changed files with 17 additions and 20 deletions

View file

@ -19,6 +19,7 @@ WORKDIR /build
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y ca-certificates cmake curl apt-get install -y ca-certificates cmake curl
# CuBLAS requirements
RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
apt-get install -y software-properties-common && \ apt-get install -y software-properties-common && \
apt-add-repository contrib && \ apt-add-repository contrib && \
@ -30,14 +31,12 @@ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
; fi ; fi
ENV PATH /usr/local/cuda/bin:${PATH} ENV PATH /usr/local/cuda/bin:${PATH}
RUN if [ "${BUILD_TYPE}" = "openblas" ]; then \ # OpenBLAS requirements
apt-get install -y libopenblas-dev \ RUN apt-get install -y libopenblas-dev
; fi
RUN if [ "${GO_TAGS}" = "stablediffusion" ]; then \ # Stable Diffusion requirements
apt-get install -y libopencv-dev && \ RUN apt-get install -y libopencv-dev && \
ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2 \ ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
; fi
COPY . . COPY . .
RUN make build RUN make build

View file

@ -15,6 +15,7 @@ WORKDIR /build
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y cmake apt-get install -y cmake
# CuBLAS requirements
RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
apt-get install -y software-properties-common && \ apt-get install -y software-properties-common && \
apt-add-repository contrib && \ apt-add-repository contrib && \
@ -26,14 +27,12 @@ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
; fi ; fi
ENV PATH /usr/local/cuda/bin:${PATH} ENV PATH /usr/local/cuda/bin:${PATH}
RUN if [ "${BUILD_TYPE}" = "openblas" ]; then \ # OpenBLAS requirements
apt-get install -y libopenblas-dev \ RUN apt-get install -y libopenblas-dev
; fi
RUN if [ "${GO_TAGS}" = "stablediffusion" ]; then \ # Stable Diffusion requirements
apt-get install -y libopencv-dev && \ RUN apt-get install -y libopencv-dev && \
ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2 \ ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
; fi
COPY . . COPY . .
RUN make build RUN make build
@ -53,6 +52,7 @@ ENV HEALTHCHECK_ENDPOINT=http://localhost:8080/readyz
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y ca-certificates curl apt-get install -y ca-certificates curl
# CuBLAS requirements
RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
apt-get install -y curl software-properties-common && \ apt-get install -y curl software-properties-common && \
apt-add-repository contrib && \ apt-add-repository contrib && \
@ -63,13 +63,11 @@ RUN if [ "${BUILD_TYPE}" = "cublas" ]; then \
apt-get install -y cuda-cudart-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcublas-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \ apt-get install -y cuda-cudart-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} libcublas-${CUDA_MAJOR_VERSION}-${CUDA_MINOR_VERSION} \
; fi ; fi
RUN if [ "${BUILD_TYPE}" = "openblas" ]; then \ # OpenBLAS requirements
apt-get install -y libopenblas0 \ RUN apt-get install -y libopenblas0
; fi
RUN if [ "${GO_TAGS}" = "stablediffusion" ]; then \ # Stable Diffusion requirements
apt-get install -y libgomp1 libopencv-core4.5 libopencv-imgcodecs4.5 \ RUN apt-get install -y libgomp1 libopencv-core4.5 libopencv-imgcodecs4.5
; fi
COPY --from=builder /build/local-ai /usr/bin/local-ai COPY --from=builder /build/local-ai /usr/bin/local-ai