Ignore DL3006 and DL3008 by default

This commit is contained in:
Romain
2020-06-01 06:23:44 +02:00
parent 2ce0b49fb5
commit 5e6645d137
10 changed files with 20 additions and 21 deletions

3
.hadolint.yaml Normal file
View File

@@ -0,0 +1,3 @@
ignored:
- DL3006
- DL3008

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/pyspark-notebook ARG BASE_CONTAINER=jupyter/pyspark-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -13,7 +12,6 @@ ENV R_LIBS_USER $SPARK_HOME/R/lib
RUN fix-permissions $R_LIBS_USER RUN fix-permissions $R_LIBS_USER
# R pre-requisites # R pre-requisites
# hadolint ignore=DL3008
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
fonts-dejavu \ fonts-dejavu \

View File

@@ -6,7 +6,6 @@
# OS/ARCH: linux/amd64 # OS/ARCH: linux/amd64
ARG ROOT_CONTAINER=ubuntu:bionic-20200403@sha256:b58746c8a89938b8c9f5b77de3b8cf1fe78210c696ab03a1442e235eea65d84f ARG ROOT_CONTAINER=ubuntu:bionic-20200403@sha256:b58746c8a89938b8c9f5b77de3b8cf1fe78210c696ab03a1442e235eea65d84f
ARG BASE_CONTAINER=$ROOT_CONTAINER ARG BASE_CONTAINER=$ROOT_CONTAINER
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -22,7 +21,6 @@ USER root
# Install all OS dependencies for notebook server that starts but lacks all # Install all OS dependencies for notebook server that starts but lacks all
# features (e.g., download as all possible file formats) # features (e.g., download as all possible file formats)
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# hadolint ignore=DL3008
RUN apt-get update \ RUN apt-get update \
&& apt-get install -yq --no-install-recommends \ && apt-get install -yq --no-install-recommends \
wget \ wget \

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/scipy-notebook ARG BASE_CONTAINER=jupyter/scipy-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -16,7 +15,6 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
USER root USER root
# R pre-requisites # R pre-requisites
# hadolint ignore=DL3008
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
fonts-dejavu \ fonts-dejavu \

View File

@@ -1,6 +1,6 @@
# Image Lint # Image Lint
To comply with [Docker best practices][LK2], we are using the [Hadolint][LK1] tool to analyse each `Dockerfile` . To comply with [Docker best practices][dbp], we are using the [Hadolint][hadolint] tool to analyse each `Dockerfile` .
## Installation ## Installation
@@ -51,18 +51,28 @@ $ make lint-all
## Ignoring Rules ## Ignoring Rules
Sometimes it is necessary to ignore [some rules][LK3]. The preferred way to do it is to flag ignored rules in the `Dockerfile`. Sometimes it is necessary to ignore [some rules][rules].
The following rules are ignored by default and sor for all images in the `.hadolint.yaml` file.
- [`DL3006`][DL3006]: We use a specific policy to manage image tags.
- `base-notebook` `FROM` clause is fixed but based on an argument (`ARG`).
- Building downstream images from (`FROM`) the latest is done on purpose.
- [`DL3008`][DL3008]: System packages are always updated (`apt-get`) to the latest version.
For other rules, 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: > 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:
```dockerfile ```dockerfile
# hadolint ignore=DL3006
FROM ubuntu FROM ubuntu
# hadolint ignore=DL3003,SC1035 # hadolint ignore=DL3003,SC1035
RUN cd /tmp && echo "hello!" RUN cd /tmp && echo "hello!"
``` ```
[LK1]: https://github.com/hadolint/hadolint [hadolint]: https://github.com/hadolint/hadolint
[LK2]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices [dbp]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices
[LK3]: https://github.com/hadolint/hadolint#rules [rules]: https://github.com/hadolint/hadolint#rules
[DL3006]: https://github.com/hadolint/hadolint/wiki/DL3006
[DL3008]: https://github.com/hadolint/hadolint/wiki/DL3008

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/base-notebook ARG BASE_CONTAINER=jupyter/base-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -9,7 +8,6 @@ LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
USER root USER root
# Install all OS dependencies for fully functional notebook server # Install all OS dependencies for fully functional notebook server
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -yq --no-install-recommends \ RUN apt-get update && apt-get install -yq --no-install-recommends \
build-essential \ build-essential \
emacs-nox \ emacs-nox \

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/scipy-notebook ARG BASE_CONTAINER=jupyter/scipy-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -14,7 +13,7 @@ USER root
# Spark dependencies # Spark dependencies
ENV APACHE_SPARK_VERSION=2.4.5 \ ENV APACHE_SPARK_VERSION=2.4.5 \
HADOOP_VERSION=2.7 HADOOP_VERSION=2.7
# hadolint ignore=DL3008
RUN apt-get -y update && \ RUN apt-get -y update && \
apt-get install --no-install-recommends -y openjdk-8-jre-headless ca-certificates-java && \ apt-get install --no-install-recommends -y openjdk-8-jre-headless ca-certificates-java && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/minimal-notebook ARG BASE_CONTAINER=jupyter/minimal-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -9,7 +8,6 @@ LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
USER root USER root
# R pre-requisites # R pre-requisites
# hadolint ignore=DL3008
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
fonts-dejavu \ fonts-dejavu \

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/minimal-notebook ARG BASE_CONTAINER=jupyter/minimal-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
@@ -9,7 +8,6 @@ LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
USER root USER root
# ffmpeg for matplotlib anim & dvipng for latex labels # ffmpeg for matplotlib anim & dvipng for latex labels
# hadolint ignore=DL3008
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg dvipng && \ apt-get install -y --no-install-recommends ffmpeg dvipng && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*

View File

@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team. # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/scipy-notebook ARG BASE_CONTAINER=jupyter/scipy-notebook
# hadolint ignore=DL3006
FROM $BASE_CONTAINER FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"