🐛Fix & Improve Suricata Dockerfile

# Summary of Changes
## Bugfixes 🐛
* Add `py3-pip` (Alpine apk package for Python3 Pip). The absence of this APK dependency will cause the container build to fail.
* Add a step to create an empty file at `/root/dist/empty.conf`, this ensures subsequent steps to cleanup don't cause the container build to fail. 
## Improvements 
* Invoke `make` with `-j $(nproc)`. This forces `make` to spread the build process out over the number of logical cores available to the `make` process, significantly decreasing build times on multi-core systems.
This commit is contained in:
Brian Lechthaler 2020-12-25 23:13:39 -08:00 committed by GitHub
parent af6ce8854d
commit 481a7ab732
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ ADD dist/ /root/dist/
# Install packages
#RUN sed -i 's/dl-cdn/dl-2/g' /etc/apk/repositories && \
RUN apk -U add \
py3-pip \
ca-certificates \
curl \
file \
@ -83,16 +84,17 @@ RUN apk -U add \
--enable-gccprotect \
--enable-pie \
--enable-luajit && \
make && \
make check && \
make install && \
make install-full && \
make -j $(nproc) && \
make check -j $(nproc) && \
make install -j $(nproc) && \
make install-full -j $(nproc) && \
#
# Setup user, groups and configs
addgroup -g 2000 suri && \
adduser -S -H -u 2000 -D -g 2000 suri && \
chmod 644 /etc/suricata/*.config && \
cp /root/dist/*.yaml /etc/suricata/ && \
touch /root/dist/empty.conf && \
cp /root/dist/*.conf /etc/suricata/ && \
cp /root/dist/*.bpf /etc/suricata/ && \
mkdir -p /etc/suricata/rules && \