2023-04-06 08:27:37 +00:00
|
|
|
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 \
|
2023-04-07 10:26:05 +00:00
|
|
|
golang git
|
2023-04-06 08:27:37 +00:00
|
|
|
|
|
|
|
RUN mkdir -p /work/malscan
|
|
|
|
COPY . /work/malscan
|
|
|
|
|
|
|
|
RUN cd /work/malscan && \
|
2023-04-07 10:26:05 +00:00
|
|
|
CGO_LDFLAGS='-lclamav' go build . && \
|
2023-04-06 08:27:37 +00:00
|
|
|
cp malscan /usr/local/bin/malscan
|
|
|
|
|
|
|
|
# Entrypoint
|
2023-04-06 09:36:31 +00:00
|
|
|
CMD /usr/local/bin/malscan
|
|
|
|
EXPOSE 8080
|