From a33c97addeb958453e7526e2daa68eaac0265605 Mon Sep 17 00:00:00 2001 From: Nicolas CARPi Date: Mon, 21 Sep 2020 03:32:27 +0200 Subject: [PATCH] Improve the docker image build * update alpine to 3.12 and drop the patch version * use "Installing for" instead of "Selecting to" for packages * use --update flag of apk * remove clean cache command as it's already empty with --no-cache flag * align nikto user creation message with the group * remove the root password locking stuff: irrelevant with alpine 3.12 * add a .dockerignore file to send less context to the daemon * bring the image size down from 47.2MB to 45.7MB --- .dockerignore | 9 +++++++++ Dockerfile | 17 ++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..007a0802 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.gitignore +.gitattributes +.editorconfig +.github +COPYING +devdocs +documentation +README.md diff --git a/Dockerfile b/Dockerfile index 50d21952..6af0c55f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.10.0 +FROM alpine:3.12 LABEL version="2.1.6" \ author="Author Paul Sec (https://github.com/PaulSec), Nikto User https://github.com/drwetter" \ @@ -10,25 +10,16 @@ COPY ["program/", "/nikto"] ENV PATH=${PATH}:/nikto -RUN echo 'Selecting packages to Nikto.' \ - && apk update \ - && apk add --no-cache --virtual .build-deps \ +RUN echo 'Installing packages for Nikto.' \ + && apk add --update --no-cache --virtual .build-deps \ perl \ perl-net-ssleay \ - && echo 'Cleaning cache from APK.' \ - && rm -rf /var/cache/apk/* \ && echo 'Creating the nikto group.' \ && addgroup nikto \ - && echo 'Creating the user nikto.' \ + && echo 'Creating the nikto user.' \ && adduser -G nikto -g "Nikto user" -s /bin/sh -D nikto \ && echo 'Changing the ownership.' \ && chown -R nikto.nikto /nikto \ - && echo 'Creating a random password for root.' \ - && export RANDOM_PASSWORD=`tr -dc A-Za-z0-9 < /dev/urandom | head -c44` \ - && echo "root:$RANDOM_PASSWORD" | chpasswd \ - && unset RANDOM_PASSWORD \ - && echo 'Locking root account.' \ - && passwd -l root \ && echo 'Finishing image.' USER nikto