From 2ce0b49fb553810d0a5013f2d0df6b48bc9afe3a Mon Sep 17 00:00:00 2001 From: Romain Date: Sat, 30 May 2020 05:44:53 +0200 Subject: [PATCH] Final review --- base-notebook/Dockerfile | 2 +- datascience-notebook/Dockerfile | 3 +-- docs/contributing/lint.md | 18 +++++++++++------- pyspark-notebook/Dockerfile | 3 +-- scipy-notebook/Dockerfile | 6 ++++-- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index a8afccea..5836c649 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -143,4 +143,4 @@ RUN fix-permissions /etc/jupyter/ # Switch back to jovyan to avoid accidental container runs as root USER $NB_UID -WORKDIR $HOME \ No newline at end of file +WORKDIR $HOME diff --git a/datascience-notebook/Dockerfile b/datascience-notebook/Dockerfile index 05b1186e..5c4ce909 100644 --- a/datascience-notebook/Dockerfile +++ b/datascience-notebook/Dockerfile @@ -32,7 +32,6 @@ ENV JULIA_VERSION=1.4.1 WORKDIR /tmp -# TODO # hadolint ignore=SC2046 RUN mkdir "/opt/julia-${JULIA_VERSION}" && \ wget -q https://julialang-s3.julialang.org/bin/linux/x64/$(echo "${JULIA_VERSION}" | cut -d. -f 1,2)"/julia-${JULIA_VERSION}-linux-x86_64.tar.gz" && \ @@ -93,4 +92,4 @@ RUN julia -e 'import Pkg; Pkg.update()' && \ rm -rf "${HOME}/.local" && \ fix-permissions "${JULIA_PKGDIR}" "${CONDA_DIR}/share/jupyter" -WORKDIR $HOME \ No newline at end of file +WORKDIR $HOME diff --git a/docs/contributing/lint.md b/docs/contributing/lint.md index 3dde76ae..65f06de3 100644 --- a/docs/contributing/lint.md +++ b/docs/contributing/lint.md @@ -1,10 +1,10 @@ # Image Lint -We are using the [Hadolint][LK1] tool to analyse each `Dockerfile` to comply with [Docker best practices][LK2]. +To comply with [Docker best practices][LK2], we are using the [Hadolint][LK1] tool to analyse each `Dockerfile` . -## Install +## Installation -There is a specific make target to install the linter. +There is a specific `make` target to install the linter. By default `hadolint` will be installed in `${HOME}/hadolint`. ```bash @@ -17,7 +17,9 @@ $ make lint-install ## Lint -The linter can be run per stack `make lint/`. +### Per Stack + +The linter can be run per stack. ```bash $ make lint/scipy-notebook @@ -39,15 +41,17 @@ Optionally you can pass arguments to the linter. $ make lint/scipy-notebook ARGS="--format codeclimate" ``` -To lint all the stacks. +### All the Stacks + +The linter can be run against all the stacks. ```bash $ make lint-all ``` -## Ignore Rules +## Ignoring Rules -Sometimes it's necessary to ignore [some rules][LK3]. The preferred way is to do it in the `Dockerfile`. +Sometimes it is necessary to ignore [some rules][LK3]. The preferred way to do it is to flag ignored rules in the `Dockerfile`. > It is also possible to ignore rules by using a special comment directly above the Dockerfile instruction you want to make an exception for. Ignore rule comments look like `# hadolint ignore=DL3001,SC1081`. For example: diff --git a/pyspark-notebook/Dockerfile b/pyspark-notebook/Dockerfile index 6342516d..dcb766b3 100644 --- a/pyspark-notebook/Dockerfile +++ b/pyspark-notebook/Dockerfile @@ -21,7 +21,6 @@ RUN apt-get -y update && \ # Using the preferred mirror to download Spark WORKDIR /tmp -# TODO # hadolint ignore=SC2046 RUN wget -q $(wget -qO- https://www.apache.org/dyn/closer.lua/spark/spark-${APACHE_SPARK_VERSION}/spark-${APACHE_SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz\?as_json | \ python -c "import sys, json; content=json.load(sys.stdin); print(content['preferred']+content['path_info'])") && \ @@ -46,4 +45,4 @@ RUN conda install --quiet -y 'pyarrow' && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" -WORKDIR $HOME \ No newline at end of file +WORKDIR $HOME diff --git a/scipy-notebook/Dockerfile b/scipy-notebook/Dockerfile index f49fef60..64bb7626 100644 --- a/scipy-notebook/Dockerfile +++ b/scipy-notebook/Dockerfile @@ -75,9 +75,11 @@ RUN git clone https://github.com/PAIR-code/facets.git && \ fix-permissions "/home/${NB_USER}" # Import matplotlib the first time to build the font cache. -ENV XDG_CACHE_HOME /home/$NB_USER/.cache/ +ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/" + RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \ fix-permissions "/home/${NB_USER}" USER $NB_UID -WORKDIR $HOME \ No newline at end of file + +WORKDIR $HOME