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`"
This commit is contained in:
Ploc
2021-06-18 18:28:19 +02:00
committed by Romain Du Chaffaut
parent 4486b32da5
commit 52b436657f
2 changed files with 21 additions and 5 deletions

View File

@@ -19,8 +19,24 @@ COPY . /home/lutim
RUN chmod -R g+rwX /home/lutim
WORKDIR /home/lutim
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 \
&& apk --update add --virtual .build-deps build-base perl-utils perl-dev postgresql14-dev vim wget zlib-dev \
RUN apk --no-cache add perl~=5 \
libpq~=14 \
perl-crypt-rijndael~=1 \
perl-io-socket-ssl~=2 \
perl-net-ssleay~=1 \
su-exec~=0.2 \
shared-mime-info~=2 \
libretls~=3 \
imagemagick~=7 \
imagemagick-perlmagick~=7 \
bash~=~5 \
&& apk --no-cache add --virtual .build-deps build-base~=0.5 \
perl-utils~=5 \
perl-dev~=5 \
postgresql14-dev~=14 \
vim~=8 \
wget~=1 \
zlib-dev~=1 \
&& cpan notest Carton Config::FromHash \
&& carton install --without test \
&& apk del .build-deps \

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -eu
@@ -14,7 +14,7 @@ then
echo ""
echo "You can then install the build dependencies with this command"
echo " sh ~lutim/docker/install-dev-env.sh"
tail -f /dev/null
exit 0
fi
@@ -28,7 +28,7 @@ then
DB_HOST=$(perl utilities/read_conf.pl pgdb/host db)
DB_PORT=$(perl utilities/read_conf.pl pgdb/port 5432)
fi
if [ -n "$DB_HOST" -a -n "$DB_PORT" ]
if [ -n "$DB_HOST" ] && [ -n "$DB_PORT" ]
then
while ! nc -vz "${DB_HOST}" "${DB_PORT}"; do
echo "Waiting for database..."