From 4f0f28c447007361af98822fdee9bbb488274027 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Thu, 14 Dec 2023 04:00:28 +0100 Subject: [PATCH] [MAINT] pin dependencies for docker build (#59) * pin dependencies * pin versions * pin base iamge * add docker linting config --- .hadolint.yaml | 3 +++ .pre-commit-config.yaml | 13 ++++++++++++- Dockerfile | 13 ++++++------- requirements.txt | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 .hadolint.yaml create mode 100644 requirements.txt diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..0f7a84c --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,3 @@ +--- +ignored: +- DL3008 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37543f0..fc3fc58 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,4 +21,15 @@ repos: - repo: https://github.com/PyCQA/flake8 rev: 6.0.0 hooks: - - id: flake8 + - id: flake8 +- repo: https://github.com/hadolint/hadolint + rev: v2.12.1-beta + hooks: + - id: hadolint-docker + name: Lint Dockerfiles + description: Runs hadolint Docker image to lint Dockerfiles + language: docker_image + types: [dockerfile] + entry: ghcr.io/hadolint/hadolint hadolint +ci: + skip: [hadolint-docker] diff --git a/Dockerfile b/Dockerfile index 1c5b228..20f48aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.9 +# https://hub.docker.com/layers/library/python/3.9-slim-bullseye/images/sha256-de58dcff6a8ccd752899e667aded074ad3e8f5fd552969ec11276adcb18930a4 +FROM python@sha256:de58dcff6a8ccd752899e667aded074ad3e8f5fd552969ec11276adcb18930a4 ARG DEBIAN_FRONTEND="noninteractive" @@ -9,16 +10,14 @@ RUN apt-get update -qq && \ ARG TEMPLATEFLOW_HOME="/templateflow" -RUN pip3 install nilearn==0.9.2 templateflow pybids h5py tqdm&& \ - mkdir -p /code && mkdir -p /templateflow - WORKDIR /code -RUN python3 -c "from templateflow.api import get; get(['MNI152NLin2009cAsym', 'MNI152NLin6Asym'])" - COPY [".", "/code"] -RUN pip install --upgrade pip && pip3 install -e . +RUN pip3 install --no-cache-dir pip==23.0.1 && \ + pip3 install --no-cache-dir --requirement requirements.txt && \ + python3 -c "from templateflow.api import get; get(['MNI152NLin2009cAsym', 'MNI152NLin6Asym'])" && \ + pip3 --no-cache-dir install --editable . ENV TEMPLATEFLOW_HOME=${TEMPLATEFLOW_HOME} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..966be51 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,33 @@ +astor==0.8.1 +bids-validator==1.14.0 +certifi==2023.11.17 +charset-normalizer==3.3.2 +click==8.1.7 +docopt==0.6.2 +formulaic==0.5.2 +h5py==3.10.0 +idna==3.6 +interface-meta==1.3.0 +joblib==1.3.2 +lxml==4.9.3 +nibabel==5.2.0 +nilearn==0.9.2 +num2words==0.5.13 +numpy==1.26.2 +packaging==23.2 +pandas==2.1.4 +pybids==0.15.6 +python-dateutil==2.8.2 +pytz==2023.3.post1 +requests==2.31.0 +scikit-learn==1.3.2 +scipy==1.11.4 +six==1.16.0 +SQLAlchemy==1.3.24 +templateflow==0.8.1 +threadpoolctl==3.2.0 +tqdm==4.66.1 +typing_extensions==4.9.0 +tzdata==2023.3 +urllib3==2.1.0 +wrapt==1.16.0