FROM ubuntu:22.04 # Deal with ClamAV installation RUN apt update -y && apt upgrade -y && apt install -y \ gcc make pkg-config python3 python3-pip python3-pytest valgrind \ check libbz2-dev libcurl4-openssl-dev libjson-c-dev libmilter-dev \ libncurses5-dev libpcre2-dev libssl-dev libxml2-dev zlib1g-dev \ cmake cargo rust-all wget RUN mkdir -p /work/clamav && \ wget https://www.clamav.net/downloads/production/clamav-1.0.1.tar.gz && \ tar xf clamav-1.0.1.tar.gz && \ mkdir clamav-build && \ cd clamav-build && \ cmake ../clamav-1.0.1 && \ make -j4 && \ make install && \ rm -Rf /work/clamav # Add at least basic (but out of date) ClamAV DB as a fallback for testing purposes COPY config/freshclam.conf /usr/local/etc/freshclam.conf RUN freshclam --foreground -v # Deal with Golang installation RUN apt update -y && apt upgrade -y && apt install -y \ golang RUN mkdir -p /work/malscan COPY . /work/malscan RUN cd /work/malscan && \ CGO_LDFLAGS='-lclamav' go build malscan.go && \ cp malscan /usr/local/bin/malscan # Entrypoint CMD /usr/local/bin/malscan