Move folder names to match image names
This commit is contained in:
24
data/Dockerfiles/clamd/Dockerfile
Normal file
24
data/Dockerfiles/clamd/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM alpine:3.6
|
||||
|
||||
LABEL maintainer "André Peters <andre.peters@servercow.de>"
|
||||
|
||||
# Add scripts
|
||||
COPY dl_files.sh bootstrap.sh ./
|
||||
|
||||
# Installation
|
||||
RUN apk add --update \
|
||||
&& apk add --no-cache clamav clamav-libunrar curl bash \
|
||||
&& chmod +x /dl_files.sh \
|
||||
&& set -ex; /bin/bash /dl_files.sh \
|
||||
&& mkdir /run/clamav \
|
||||
&& chown clamav:clamav /run/clamav \
|
||||
&& chmod 750 /run/clamav \
|
||||
&& sed -i '/Foreground yes/s/^#//g' /etc/clamav/clamd.conf \
|
||||
&& sed -i '/TCPSocket 3310/s/^#//g' /etc/clamav/clamd.conf \
|
||||
&& sed -i '/Foreground yes/s/^#//g' /etc/clamav/freshclam.conf
|
||||
|
||||
# Port provision
|
||||
EXPOSE 3310
|
||||
|
||||
# AV daemon bootstrapping
|
||||
CMD ["/bootstrap.sh"]
|
10
data/Dockerfiles/clamd/bootstrap.sh
Executable file
10
data/Dockerfiles/clamd/bootstrap.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
trap "kill 0" SIGINT
|
||||
|
||||
touch /var/log/clamav/clamd.log /var/log/clamav/freshclam.log
|
||||
chown -R clamav:clamav /var/log/clamav/
|
||||
|
||||
freshclam -d &
|
||||
clamd &
|
||||
|
||||
tail -f /var/log/clamav/clamd.log /var/log/clamav/freshclam.log
|
32
data/Dockerfiles/clamd/dl_files.sh
Executable file
32
data/Dockerfiles/clamd/dl_files.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -a DB_MIRRORS=(
|
||||
"switch.clamav.net"
|
||||
"clamavdb.heanet.ie"
|
||||
"clamav.iol.cz"
|
||||
"clamav.univ-nantes.fr"
|
||||
"clamav.easynet.fr"
|
||||
"clamav.begi.net"
|
||||
)
|
||||
declare -a DB_MIRRORS=( $(shuf -e "${DB_MIRRORS[@]}") )
|
||||
|
||||
DB_FILES=(
|
||||
"bytecode.cvd"
|
||||
"daily.cvd"
|
||||
"main.cvd"
|
||||
)
|
||||
|
||||
for i in "${DB_MIRRORS[@]}"; do
|
||||
for j in "${DB_FILES[@]}"; do
|
||||
[[ -f "/var/lib/clamav/${j}" && -s "/var/lib/clamav/${j}" ]] && continue;
|
||||
if [[ $(curl -o /dev/null --connect-timeout 1 \
|
||||
--max-time 1 \
|
||||
--silent \
|
||||
--head \
|
||||
--write-out "%{http_code}\n" "${i}/${j}") == 200 ]]; then
|
||||
curl "${i}/${j}" -o "/var/lib/clamav/${j}" -#
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
chown clamav:clamav /var/lib/clamav/*.cvd
|
Reference in New Issue
Block a user