Skip to content

Commit 515b0fd

Browse files
committed
Add dockerfile linting
1 parent a06679b commit 515b0fd

File tree

10 files changed

+388
-293
lines changed

10 files changed

+388
-293
lines changed

.config/hadolint.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ignored:
2+
- DL3003
3+
- SC2103
4+
- DL3041
5+
- DL4006
6+
- DL3013

.github/workflows/test.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,32 @@ jobs:
120120
with:
121121
args: --config=.config/ruff.toml check
122122
src: src
123+
124+
lint_dockerfiles:
125+
runs-on: ubuntu-24.04
126+
name: Lint Dockerfiles
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
dockerfile:
131+
- Dockerfile-fedora28
132+
- Dockerfile-fedora30
133+
- Dockerfile-fedora32
134+
- Dockerfile-fedora34
135+
- Dockerfile-fedora36
136+
- Dockerfile-fedora38
137+
- Dockerfile-fedora40
138+
- Dockerfile-fuzz
139+
steps:
140+
- name: Checkout
141+
uses: actions/checkout@v4
142+
with:
143+
fetch-depth: 1
144+
show-progress: false
145+
persist-credentials: false
146+
147+
- name: Lint ${{ matrix.dockerfile }}
148+
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0
149+
with:
150+
dockerfile: ./docker/${{ matrix.dockerfile }}
151+
config: .config/hadolint.yaml

docker/Dockerfile-fedora28

Lines changed: 52 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,65 @@
11
FROM fedora:28 AS python3.3
22

3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
35
# CircleCI required tools
4-
RUN dnf install -y \
5-
openssh \
6-
tar \
7-
gzip \
8-
gpg \
9-
ca-certificates \
10-
&& dnf clean all && rm -rf /var/cache/dnf/*
6+
RUN <<EOF
7+
dnf install -y \
8+
openssh \
9+
tar \
10+
gzip \
11+
gpg \
12+
ca-certificates
13+
dnf clean all && rm -rf /var/cache/dnf/*
14+
EOF
1115

1216
# Install git
13-
RUN dnf install -y \
14-
@development-tools \
15-
dh-autoreconf \
16-
curl-devel \
17-
expat-devel \
18-
gettext-devel \
19-
openssl-devel \
20-
perl-devel \
21-
zlib-devel \
22-
&& dnf clean all && rm -rf /var/cache/dnf/* \
23-
&& curl -f -L https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.5.tar.gz --output git-2.18.5.tar.gz \
24-
&& tar -zxf git-2.18.5.tar.gz \
25-
&& cd git-2.18.5 \
26-
&& make configure \
27-
&& ./configure --prefix=/usr/local \
28-
&& make all \
29-
&& make install \
30-
&& cd .. \
31-
&& rm -rf git-2.18.5 \
32-
&& dnf autoremove -y \
33-
@development-tools \
34-
dh-autoreconf \
35-
curl-devel \
36-
expat-devel \
37-
gettext-devel \
38-
openssl-devel \
39-
perl-devel \
40-
zlib-devel \
41-
&& dnf clean all && rm -rf /var/cache/dnf/*
17+
RUN <<EOF
18+
dnf install -y \
19+
@development-tools \
20+
dh-autoreconf \
21+
curl-devel \
22+
expat-devel \
23+
gettext-devel \
24+
openssl-devel \
25+
perl-devel \
26+
zlib-devel
27+
dnf clean all && rm -rf /var/cache/dnf/*
28+
curl -f -L https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.5.tar.gz --output git-2.18.5.tar.gz
29+
tar -zxf git-2.18.5.tar.gz
30+
cd git-2.18.5
31+
make configure
32+
./configure --prefix=/usr/local
33+
make all
34+
make install
35+
cd ..
36+
rm -rf git-2.18.5
37+
dnf autoremove -y \
38+
@development-tools \
39+
dh-autoreconf \
40+
curl-devel \
41+
expat-devel \
42+
gettext-devel \
43+
openssl-devel \
44+
perl-devel \
45+
zlib-devel
46+
dnf clean all && rm -rf /var/cache/dnf/*
47+
EOF
4248

4349
# Python versions
44-
RUN dnf install -y \
45-
python33 \
46-
&& dnf clean all && rm -rf /var/cache/dnf/* \
47-
&& curl https://bootstrap.pypa.io/pip/3.3/get-pip.py | python3.3
50+
RUN <<EOF
51+
dnf install -y python33
52+
dnf clean all && rm -rf /var/cache/dnf/*
53+
curl https://bootstrap.pypa.io/pip/3.3/get-pip.py | python3.3
54+
EOF
4855

4956
# Other packages required for tests
50-
RUN dnf install -y \
51-
bzip2 \
52-
&& dnf clean all && rm -rf /var/cache/dnf/*
57+
RUN <<EOF
58+
dnf install -y bzip2
59+
dnf clean all && rm -rf /var/cache/dnf/*
60+
EOF
5361

54-
RUN pip3 install 'tox<3' 'virtualenv<16' 'setuptools_scm<7'
62+
RUN pip3 install --no-cache-dir 'tox<3' 'virtualenv<16' 'setuptools_scm<7'
5563

5664
WORKDIR /tmp/work
5765
ENTRYPOINT ["/bin/bash"]

docker/Dockerfile-fedora30

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,99 @@
11
FROM fedora:30 AS base
22

33
# CircleCI required tools
4-
RUN dnf install -y \
5-
git \
6-
openssh \
7-
tar \
8-
gzip \
9-
gpg \
10-
ca-certificates \
11-
&& dnf clean all && rm -rf /var/cache/dnf/*
4+
RUN <<EOF
5+
dnf install -y \
6+
git \
7+
openssh \
8+
tar \
9+
gzip \
10+
gpg \
11+
ca-certificates
12+
dnf clean all && rm -rf /var/cache/dnf/*
13+
EOF
1214

1315
# Other packages required for tests
14-
RUN dnf install -y \
15-
bzip2 \
16-
&& dnf clean all && rm -rf /var/cache/dnf/*
16+
RUN <<EOF
17+
dnf install -y bzip2
18+
dnf clean all && rm -rf /var/cache/dnf/*
19+
EOF
1720

18-
RUN pip3 install tox==3.11.1 virtualenv==16.6.0
21+
RUN pip3 install --no-cache-dir tox==3.11.1 virtualenv==16.6.0
1922

2023
WORKDIR /tmp/work
2124
ENTRYPOINT ["/bin/bash"]
2225

2326
##
2427
FROM base AS python2.7
2528

26-
RUN dnf install -y \
27-
python27 \
28-
python2-test \
29-
python2-pip \
30-
findutils \
31-
&& dnf clean all && rm -rf /var/cache/dnf/*
29+
RUN <<EOF
30+
dnf install -y \
31+
python27 \
32+
python2-test \
33+
python2-pip \
34+
findutils
35+
dnf clean all && rm -rf /var/cache/dnf/*
36+
EOF
3237

3338
##
3439
FROM base AS python3.4
3540

36-
RUN dnf install -y \
37-
python34 \
38-
&& dnf clean all && rm -rf /var/cache/dnf/* \
39-
&& curl https://bootstrap.pypa.io/pip/3.4/get-pip.py | python3.4
41+
RUN <<EOF
42+
dnf install -y python34
43+
dnf clean all && rm -rf /var/cache/dnf/*
44+
curl https://bootstrap.pypa.io/pip/3.4/get-pip.py | python3.4
45+
EOF
4046

4147
##
4248
FROM base AS python3.5
4349

44-
RUN dnf install -y \
45-
python35 \
46-
&& dnf clean all && rm -rf /var/cache/dnf/* \
47-
&& curl https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3.5
50+
RUN <<EOF
51+
dnf install -y python35
52+
dnf clean all && rm -rf /var/cache/dnf/*
53+
curl https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3.5
54+
EOF
4855

4956
##
5057
FROM base AS python3.6
5158

52-
RUN dnf install -y \
53-
python36 \
54-
&& dnf clean all && rm -rf /var/cache/dnf/* \
55-
&& curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6
59+
RUN <<EOF
60+
dnf install -y python36
61+
dnf clean all && rm -rf /var/cache/dnf/*
62+
curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6
63+
EOF
5664

5765
##
5866
FROM base AS python3.7
5967

60-
RUN dnf install -y \
61-
python37 \
62-
python3-test \
63-
python3-pip \
64-
&& dnf clean all && rm -rf /var/cache/dnf/*
68+
RUN <<EOF
69+
dnf install -y \
70+
python37 \
71+
python3-test \
72+
python3-pip
73+
dnf clean all && rm -rf /var/cache/dnf/*
74+
EOF
6575

6676
##
6777
FROM base AS python3.8
6878

69-
RUN dnf install -y \
70-
python38 \
71-
&& dnf clean all && rm -rf /var/cache/dnf/* \
72-
&& curl https://bootstrap.pypa.io/get-pip.py | python3.8
79+
RUN <<EOF
80+
dnf install -y python38
81+
dnf clean all && rm -rf /var/cache/dnf/*
82+
curl https://bootstrap.pypa.io/get-pip.py | python3.8
83+
EOF
7384

7485
##
7586
FROM base AS pypy
7687

77-
RUN dnf install -y \
78-
pypy \
79-
&& dnf clean all && rm -rf /var/cache/dnf/*
88+
RUN <<EOF
89+
dnf install -y pypy
90+
dnf clean all && rm -rf /var/cache/dnf/*
91+
EOF
8092

8193
##
8294
FROM base AS pypy3
8395

84-
RUN dnf install -y \
85-
pypy3 \
86-
&& dnf clean all && rm -rf /var/cache/dnf/*
96+
RUN <<EOF
97+
dnf install -y pypy3
98+
dnf clean all && rm -rf /var/cache/dnf/*
99+
EOF

0 commit comments

Comments
 (0)