Fix dockerfile linter warnings (#2291)

This commit is contained in:
TianlongLiang 2023-06-15 16:52:48 +08:00 committed by GitHub
parent fca81fcd98
commit 8f82b1e8a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 55 deletions

View File

@ -81,7 +81,7 @@ RUN mkdir /opt/bazelisk \
# #
# install clang+llvm # install clang+llvm
ARG LLVM_VER=14 ARG LLVM_VER=14
RUN apt-get purge -y clang-10 llvm-10 && apt autoremove -y RUN apt-get purge -y clang-10 llvm-10 && apt-get autoremove -y
WORKDIR /etc/apt/apt.conf.d WORKDIR /etc/apt/apt.conf.d
RUN touch 99verfiy-peer.conf \ RUN touch 99verfiy-peer.conf \
&& echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf && echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
@ -110,14 +110,15 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip \
# #
# Install github-cli. It doens't work as a feature of devcontainer.json # Install github-cli. It doens't work as a feature of devcontainer.json
RUN cd /tmp \ WORKDIR /tmp
&& wget https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_linux_amd64.deb \ RUN wget -q https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_linux_amd64.deb \
&& dpkg -i gh_2.20.2_linux_amd64.deb && dpkg -i gh_2.20.2_linux_amd64.deb
# #
# Install NodeJS # Install NodeJS
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash - RUN wget -qO- https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install -y nodejs # hadolint ignore=DL3008
RUN apt-get install -y nodejs --no-install-recommends
# set path # set path
ENV PATH="/opt/bazelisk:/usr/lib/llvm-${LLVM_VER}/bin:${PATH}" ENV PATH="/opt/bazelisk:/usr/lib/llvm-${LLVM_VER}/bin:${PATH}"

View File

@ -5,8 +5,11 @@ FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
cmake build-essential git wget python3.10 python3-pip cmake build-essential git wget python3.10 python3-pip --no-install-recommends \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ARG WASI_SDK_VER=19 ARG WASI_SDK_VER=19
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \ RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \
@ -18,6 +21,6 @@ WORKDIR /wasi-nn/test
COPY core/iwasm/libraries/wasi-nn/test/requirements.txt . COPY core/iwasm/libraries/wasi-nn/test/requirements.txt .
RUN pip3 install -r requirements.txt && rm requirements.txt RUN pip3 install --no-cache-dir -r requirements.txt && rm requirements.txt
ENTRYPOINT [ "bash", "./build.sh" ] ENTRYPOINT [ "bash", "./build.sh" ]

View File

@ -5,8 +5,9 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
cmake build-essential git cmake build-essential git --no-install-recommends
WORKDIR /home/wamr WORKDIR /home/wamr
@ -14,11 +15,18 @@ COPY . .
WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build
# hadolint ignore=DL3008
RUN apt-get install -y wget ca-certificates --no-install-recommends \
&& mkdir /usr/local/share/ca-certificates/cacert.org \
&& wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates \
&& git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
RUN cmake \ RUN cmake \
-DWAMR_BUILD_WASI_NN=1 \ -DWAMR_BUILD_WASI_NN=1 \
.. ..
RUN make -j $(grep -c ^processor /proc/cpuinfo) RUN make -j "$(grep -c ^processor /proc/cpuinfo)"
FROM ubuntu:22.04 FROM ubuntu:22.04

View File

@ -5,8 +5,9 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
cmake build-essential git cmake build-essential git --no-install-recommends
WORKDIR /home/wamr WORKDIR /home/wamr
@ -14,19 +15,27 @@ COPY . .
WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build
RUN cmake \ # hadolint ignore=DL3008
-DWAMR_BUILD_WASI_NN=1 \ RUN apt-get install -y wget ca-certificates --no-install-recommends \
-DWASI_NN_ENABLE_GPU=1 \ && mkdir /usr/local/share/ca-certificates/cacert.org \
.. && wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates \
&& git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
RUN make -j $(grep -c ^processor /proc/cpuinfo) RUN cmake \
-DWAMR_BUILD_WASI_NN=1 \
-DWASI_NN_ENABLE_GPU=1 \
..
RUN make -j "$(grep -c ^processor /proc/cpuinfo)"
FROM nvidia/cuda:11.3.0-runtime-ubuntu20.04 FROM nvidia/cuda:11.3.0-runtime-ubuntu20.04
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ocl-icd-libopencl1 \ ocl-icd-libopencl1 \
ocl-icd-opencl-dev \ ocl-icd-opencl-dev \
clinfo && \ clinfo && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
RUN mkdir -p /etc/OpenCL/vendors && \ RUN mkdir -p /etc/OpenCL/vendors && \

View File

@ -6,22 +6,33 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
cmake build-essential git curl libssl-dev python3 cmake build-essential git curl libssl-dev python3 --no-install-recommends \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y wget ca-certificates --no-install-recommends \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /usr/local/share/ca-certificates/cacert.org \
&& wget -qP /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt \
&& update-ca-certificates \
&& git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
# Build TensorFlow Lite VX delegate default built for x86-64 simulator # Build TensorFlow Lite VX delegate default built for x86-64 simulator
WORKDIR /tmp WORKDIR /tmp
RUN git clone https://github.com/VeriSilicon/TIM-VX.git tim-vx RUN git clone https://github.com/VeriSilicon/TIM-VX.git tim-vx \
RUN git clone https://github.com/VeriSilicon/tflite-vx-delegate.git && git clone https://github.com/VeriSilicon/tflite-vx-delegate.git \
RUN git clone https://github.com/tensorflow/tensorflow.git && git clone https://github.com/tensorflow/tensorflow.git
# Build TIM-VX # Build TIM-VX
WORKDIR /tmp/tim-vx/host_build WORKDIR /tmp/tim-vx/host_build
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../ RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../ \
RUN make -j$(grep -c ^processor /proc/cpuinfo) && make -j "$(grep -c ^processor /proc/cpuinfo)" \
RUN make install && make install
WORKDIR /tmp/tim-vx WORKDIR /tmp/tim-vx
#RUN mkdir -p prebuilt-sdk/x86_64_linux/lib/include #RUN mkdir -p prebuilt-sdk/x86_64_linux/lib/include
@ -31,22 +42,23 @@ WORKDIR /tmp/tim-vx
# Build TensorFlow Lite # Build TensorFlow Lite
WORKDIR /tmp/tensorflow/build WORKDIR /tmp/tensorflow/build
RUN cmake \ RUN cmake \
-DBUILD_SHARED_LIBS=ON=on \ -DBUILD_SHARED_LIBS=ON=on \
-DTFLITE_ENABLE_RUY=on \ -DTFLITE_ENABLE_RUY=on \
-DTFLITE_ENABLE_NNAPI=off \ -DTFLITE_ENABLE_NNAPI=off \
-DTFLITE_ENABLE_XNNPACK=on \ -DTFLITE_ENABLE_XNNPACK=on \
-DTFLITE_ENABLE_EXTERNAL_DELEGATE=on \ -DTFLITE_ENABLE_EXTERNAL_DELEGATE=on \
../tensorflow/lite/ ../tensorflow/lite/
RUN make -j$(grep -c ^processor /proc/cpuinfo) RUN make -j "$(grep -c ^processor /proc/cpuinfo)" \
RUN make install && make install \
RUN cp --no-preserve=ownership -d lib*.so* /usr/local/lib && cp --no-preserve=ownership -d lib*.so* /usr/local/lib \
RUN cp -r --no-preserve=ownership -d flatbuffers/include/flatbuffers /usr/local/include && cp -r --no-preserve=ownership -d flatbuffers/include/flatbuffers /usr/local/include
# install header files # install header files
RUN install -d /usr/local/include/tensorflow/lite && \ RUN install -d /usr/local/include/tensorflow/lite
cd /tmp/tensorflow/tensorflow/lite && \ WORKDIR /tmp/tensorflow/tensorflow/lite
cp --parents \ # hadolint ignore=SC2046
$(find . -name "*.h*") \ RUN cp --parents \
/usr/local/include/tensorflow/lite $(find . -name "*.h*") \
/usr/local/include/tensorflow/lite
# install version.h from core # install version.h from core
RUN install -d /usr/local/include/tensorflow/core/public && \ RUN install -d /usr/local/include/tensorflow/core/public && \
cp /tmp/tensorflow/tensorflow/core/public/version.h /usr/local/include/tensorflow/core/public cp /tmp/tensorflow/tensorflow/core/public/version.h /usr/local/include/tensorflow/core/public
@ -55,21 +67,22 @@ RUN install -d /usr/local/include/tensorflow/core/public && \
# Build Vx Delegate default built for x86-64 simulator # Build Vx Delegate default built for x86-64 simulator
WORKDIR /tmp/tflite-vx-delegate/build WORKDIR /tmp/tflite-vx-delegate/build
RUN cmake \ RUN cmake \
-DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \
-DFETCHCONTENT_SOURCE_DIR_TENSORFLOW=/tmp/tensorflow \ -DFETCHCONTENT_SOURCE_DIR_TENSORFLOW=/tmp/tensorflow \
-DTFLITE_LIB_LOC=/usr/local/lib/libtensorflow-lite.so \ -DTFLITE_LIB_LOC=/usr/local/lib/libtensorflow-lite.so \
-DTIM_VX_INSTALL=/usr/local \ -DTIM_VX_INSTALL=/usr/local \
-DCMAKE_INSTALL_PREFIX=/usr/ \ -DCMAKE_INSTALL_PREFIX=/usr/ \
../ ../
RUN make vx_delegate -j$(grep -c ^processor /proc/cpuinfo) RUN make vx_delegate -j "$(grep -c ^processor /proc/cpuinfo)" \
RUN make install && make install \
RUN cp --no-preserve=ownership -d lib*.so* /usr/lib && cp --no-preserve=ownership -d lib*.so* /usr/lib
# install header files # install header files
RUN install -d /usr/local/include/tensorflow-lite-vx-delegate && \ RUN install -d /usr/local/include/tensorflow-lite-vx-delegate
cd /tmp/tflite-vx-delegate/ && \ WORKDIR /tmp/tflite-vx-delegate/
cp --parents \ # hadolint ignore=SC2046
$(find . -name "*.h*") \ RUN cp --parents \
/usr/local/include/tensorflow-lite-vx-delegate $(find . -name "*.h*") \
/usr/local/include/tensorflow-lite-vx-delegate
ENV VIVANTE_SDK_DIR=/tmp/tim-vx/prebuilt-sdk/x86_64_linux/ ENV VIVANTE_SDK_DIR=/tmp/tim-vx/prebuilt-sdk/x86_64_linux/
ENV VSIMULATOR_CONFIG=czl ENV VSIMULATOR_CONFIG=czl
@ -84,6 +97,7 @@ COPY . .
WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build WORKDIR /home/wamr/core/iwasm/libraries/wasi-nn/test/build
# hadolint ignore=SC2086
RUN cmake \ RUN cmake \
-DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}:/usr/local/lib/ \ -DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}:/usr/local/lib/ \
-DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}:/usr/local/include/ \ -DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}:/usr/local/include/ \
@ -92,7 +106,7 @@ RUN cmake \
-DWASI_NN_EXT_DELEGATE_PATH="/usr/lib/libvx_delegate.so" \ -DWASI_NN_EXT_DELEGATE_PATH="/usr/lib/libvx_delegate.so" \
.. ..
RUN make -j $(grep -c ^processor /proc/cpuinfo) RUN make -j "$(grep -c ^processor /proc/cpuinfo)"
RUN cp /home/wamr/core/iwasm/libraries/wasi-nn/test/build/iwasm /run/iwasm RUN cp /home/wamr/core/iwasm/libraries/wasi-nn/test/build/iwasm /run/iwasm