Files
docker_clamav/Dockerfile
T
tobias 66ca4aa335 Switch from clamscan to clamd + clamdscan --multiscan
clamscan single-threaded scans were the LS26 bottleneck. Daemon mode
parallelises across MaxThreads=8 and only loads signatures once.

- Add clamav-daemon + clamav-clamdscan packages.
- start.sh::start_clamd waits up to 60s for /tmp/clamd.sock.
- New clamd.conf: MaxThreads 8, DetectPUA, AlertOLE2Macros,
  ExcludePath ^/data/(proc|sys|dev|run)/, log to /tmp/clamd.log.
- Drop final USER user so clamd can own its socket as clamav.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 14:09:25 +02:00

30 lines
920 B
Docker

FROM python:3-alpine as builder
RUN apk add -u --no-cache clamav clamav-dev freshclam bash clamav-libunrar
RUN pip install fangfrisch
RUN mkdir -m 0770 -p /var/lib/fangfrisch
RUN chgrp clamav /var/lib/fangfrisch
ADD fangfrisch.conf /etc/fangfrisch.conf
USER clamav
RUN fangfrisch --conf /etc/fangfrisch.conf initdb
RUN fangfrisch --conf /etc/fangfrisch.conf refresh
RUN freshclam
FROM alpine
ARG PUID=1001
ARG PGID=1001
MAINTAINER tabledevil
RUN apk add -u --no-cache clamav clamav-daemon clamav-clamdscan bash clamav-libunrar
COPY --from=builder /var/lib/clamav /var/lib/clamav
ADD clamd.conf /etc/clamav/clamd.conf
ADD start.sh /start.sh
RUN chmod +x /start.sh
RUN chown root /usr/bin/freshclam
RUN chmod u+s /usr/bin/freshclam
RUN mkdir -p /tmp && chown clamav:clamav /tmp
RUN addgroup -g ${PGID} user && \
adduser -D -u ${PUID} -G user user && \
adduser user clamav
ENTRYPOINT ["/start.sh"]
CMD ["shell"]