Files
docker_clamav/Dockerfile
T
tobias d73188c3b9 Pin Alpine 3.23, single base for builder + runtime, add smoke test
- Both stages on alpine:3.23 (was python:3-alpine + alpine:latest).
  Major.minor pin gives security patches without breaking on rebase.
- fangfrisch installed in /opt/fangfrisch venv (PEP 668 blocks
  system pip on modern Alpine).
- Drop deprecated MAINTAINER instruction in favour of LABEL.
- test_smoke.sh: image present + version + sig count + EICAR.
  Validated end-to-end on amd64 Linux: ClamAV 1.4.4, 3.85M sigs.

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

32 lines
1.2 KiB
Docker

FROM alpine:3.23 AS builder
LABEL maintainer="tabledevil"
RUN apk add --no-cache clamav clamav-libunrar freshclam python3 py3-pip bash
# fangfrisch needs Python; PEP 668 on modern Alpine blocks system-pip, use venv.
RUN python3 -m venv /opt/fangfrisch && /opt/fangfrisch/bin/pip install fangfrisch
RUN mkdir -m 0770 -p /var/lib/fangfrisch && chgrp clamav /var/lib/fangfrisch
ADD fangfrisch.conf /etc/fangfrisch.conf
USER clamav
RUN /opt/fangfrisch/bin/fangfrisch --conf /etc/fangfrisch.conf initdb
RUN /opt/fangfrisch/bin/fangfrisch --conf /etc/fangfrisch.conf refresh
RUN freshclam
FROM alpine:3.23
ARG PUID=1001
ARG PGID=1001
LABEL maintainer="tabledevil"
LABEL docker.cmd="docker run -it --rm -v /folder/to/scan:/data:ro --network=none tabledevil/clamav scan"
RUN apk add --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"]