From 9ea8af63fc20c8bab0f1e06ed95ec5e7c76a81c5 Mon Sep 17 00:00:00 2001 From: ORippler Date: Tue, 2 Aug 2022 13:00:11 +0000 Subject: [PATCH 1/4] Fix Dockerfile 1. Install `nodejs npm ruby` (first two required by prettier hook, last one required by markdownlint) 2. Readd `./requirements/dev.txt` with appropriate packages needed for development --- Dockerfile | 1 + requirements/dev.txt | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 requirements/dev.txt diff --git a/Dockerfile b/Dockerfile index ff5e07b4a1..70f020007f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,7 @@ COPY ./requirements/openvino.txt /tmp/anomalib/requirements/openvino.txt RUN pip install -r /tmp/anomalib/requirements/openvino.txt # Install other requirements related to development +RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y nodejs npm ruby COPY ./requirements/dev.txt /tmp/anomalib/requirements/dev.txt RUN pip install -r /tmp/anomalib/requirements/dev.txt diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000000..48eecbe179 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,7 @@ +black==22.3.0 +isort==5.10.1 +pylint +flake8 +pytest +pre-commit>=2.15.0 +tox>=3.24.3 From 485c51561b46f847fea84a19c35dfa4a14b18fa4 Mon Sep 17 00:00:00 2001 From: ORippler Date: Tue, 2 Aug 2022 15:19:38 +0000 Subject: [PATCH 2/4] Address codacy complaints --- Dockerfile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 70f020007f..9cec34100a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,20 @@ FROM nvidia/cuda:11.4.0-devel-ubuntu20.04 AS python_base_cuda LABEL MAINTAINER="Anomalib Development Team" # Update system and install wget -RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y wget ffmpeg libpython3.8 git sudo +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \ + wget=1.20.3-1ubuntu2 \ + ffmpeg=7:4.2.7-0ubuntu0.1 \ + libpython3.8=3.8.10-0ubuntu1~20.04.5 \ + git=1:2.25.1-1ubuntu3.5 \ + sudo=1.8.31-1ubuntu1.2 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* # Install Conda RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh --quiet && \ - bash ~/miniconda.sh -b -p /opt/conda + bash ~/miniconda.sh -b -p /opt/conda && \ + rm ~/miniconda.sh ENV PATH "/opt/conda/bin:${PATH}" RUN conda install python=3.8 @@ -29,7 +38,13 @@ COPY ./requirements/openvino.txt /tmp/anomalib/requirements/openvino.txt RUN pip install -r /tmp/anomalib/requirements/openvino.txt # Install other requirements related to development -RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y nodejs npm ruby +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \ + nodejs=10.19.0~dfsg-3ubuntu1 \ + npm=6.14.4+ds-1ubuntu2 \ + ruby=1:2.7+1 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* COPY ./requirements/dev.txt /tmp/anomalib/requirements/dev.txt RUN pip install -r /tmp/anomalib/requirements/dev.txt From cce62308e65369f0ae9a2a811315a8bb894fb27f Mon Sep 17 00:00:00 2001 From: ORippler Date: Tue, 2 Aug 2022 15:26:36 +0000 Subject: [PATCH 3/4] Disable pip cache in Dockerfile for smaller Images --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9cec34100a..8faa03f56a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,10 +32,10 @@ FROM python_base_cuda as anomalib_development_env # Install all anomalib requirements COPY ./requirements/base.txt /tmp/anomalib/requirements/base.txt -RUN pip install -r /tmp/anomalib/requirements/base.txt +RUN pip install --no-cache-dir -r /tmp/anomalib/requirements/base.txt COPY ./requirements/openvino.txt /tmp/anomalib/requirements/openvino.txt -RUN pip install -r /tmp/anomalib/requirements/openvino.txt +RUN pip install --no-cache-dir -r /tmp/anomalib/requirements/openvino.txt # Install other requirements related to development RUN apt-get update && \ @@ -46,9 +46,9 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY ./requirements/dev.txt /tmp/anomalib/requirements/dev.txt -RUN pip install -r /tmp/anomalib/requirements/dev.txt +RUN pip install --no-cache-dir -r /tmp/anomalib/requirements/dev.txt # Install anomalib COPY . /anomalib WORKDIR /anomalib -RUN pip install -e . +RUN pip install --no-cache-dir -e . From 207ac1a75739414d4822bba56a963db120817c70 Mon Sep 17 00:00:00 2001 From: ORippler Date: Tue, 2 Aug 2022 16:00:12 +0000 Subject: [PATCH 4/4] Pin versions to the ones used by pre-commit --- requirements/dev.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 48eecbe179..71712ca98d 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,7 +1,7 @@ -black==22.3.0 +black==22.6.0 isort==5.10.1 -pylint -flake8 +pylint==2.14.5 +flake8==4.0.1 pytest pre-commit>=2.15.0 tox>=3.24.3