Skip to content

Commit 52b4366

Browse files
Plocoupala
authored andcommitted
fix: follow hadolint hints
Follow hadolint best practices in order to have a docker build that is as reliable as possible. - first best practice is to "Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`" (see [DL3018](https://github.com/hadolint/hadolint/wiki/DL3018)) - second best practice is to use "`--no-cache` switch to avoid the need to use `--update`"
1 parent 4486b32 commit 52b4366

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

Dockerfile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,24 @@ COPY . /home/lutim
1919
RUN chmod -R g+rwX /home/lutim
2020

2121
WORKDIR /home/lutim
22-
RUN apk --update add perl libpq perl-crypt-rijndael perl-io-socket-ssl perl-net-ssleay su-exec shared-mime-info libretls imagemagick imagemagick-perlmagick \
23-
&& apk --update add --virtual .build-deps build-base perl-utils perl-dev postgresql14-dev vim wget zlib-dev \
22+
RUN apk --no-cache add perl~=5 \
23+
libpq~=14 \
24+
perl-crypt-rijndael~=1 \
25+
perl-io-socket-ssl~=2 \
26+
perl-net-ssleay~=1 \
27+
su-exec~=0.2 \
28+
shared-mime-info~=2 \
29+
libretls~=3 \
30+
imagemagick~=7 \
31+
imagemagick-perlmagick~=7 \
32+
bash~=~5 \
33+
&& apk --no-cache add --virtual .build-deps build-base~=0.5 \
34+
perl-utils~=5 \
35+
perl-dev~=5 \
36+
postgresql14-dev~=14 \
37+
vim~=8 \
38+
wget~=1 \
39+
zlib-dev~=1 \
2440
&& cpan notest Carton Config::FromHash \
2541
&& carton install --without test \
2642
&& apk del .build-deps \

docker/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -eu
44

@@ -14,7 +14,7 @@ then
1414
echo ""
1515
echo "You can then install the build dependencies with this command"
1616
echo " sh ~lutim/docker/install-dev-env.sh"
17-
17+
1818
tail -f /dev/null
1919
exit 0
2020
fi
@@ -28,7 +28,7 @@ then
2828
DB_HOST=$(perl utilities/read_conf.pl pgdb/host db)
2929
DB_PORT=$(perl utilities/read_conf.pl pgdb/port 5432)
3030
fi
31-
if [ -n "$DB_HOST" -a -n "$DB_PORT" ]
31+
if [ -n "$DB_HOST" ] && [ -n "$DB_PORT" ]
3232
then
3333
while ! nc -vz "${DB_HOST}" "${DB_PORT}"; do
3434
echo "Waiting for database..."

0 commit comments

Comments
 (0)