centos.Dockerfile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. FROM quay.io/centos/centos:stream8 as build
  2. # Set timezone to Europe/Zurich
  3. ENV TZ=Europe/Zurich
  4. # Install golang
  5. RUN mkdir -p /go && chmod -R 777 /go \
  6. && dnf -y update \
  7. && dnf -y group install "Development Tools" \
  8. && dnf install -y epel-release \
  9. && dnf -y install golang \
  10. && dnf clean all
  11. ENV GOPATH=/go \
  12. PATH="$GOPATH/bin:/usr/local/go/bin:$PATH"
  13. # Build go package
  14. ADD . /go/src/clamav-rest/
  15. RUN cd /go/src/clamav-rest && go mod download github.com/dutchcoders/go-clamd@latest && go mod init clamav-rest && go mod tidy && go mod vendor && go build -v
  16. FROM quay.io/centos/centos:stream8
  17. # Copy compiled clamav-rest binary from build container to production container
  18. COPY --from=build /go/src/clamav-rest/clamav-rest /usr/bin/
  19. # Install ClamAV
  20. RUN dnf -y update \
  21. && dnf install -y epel-release \
  22. && dnf install -y clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd \
  23. && mkdir /run/clamav \
  24. && chown clamscan:clamscan /run/clamav \
  25. # Clean
  26. && dnf clean -y all --enablerepo='*' \
  27. && rm -Rf /tmp/*
  28. # Configure clamAV to run in foreground with port 3310
  29. RUN sed -i 's/^Example$/# Example/g' /etc/clamd.d/scan.conf \
  30. && sed -i 's/^#Foreground .*$/Foreground true/g' /etc/clamd.d/scan.conf \
  31. && sed -i 's/^#TCPSocket .*$/TCPSocket 3310/g' /etc/clamd.d/scan.conf \
  32. && sed -i 's/^#Foreground .*$/Foreground true/g' /etc/freshclam.conf
  33. RUN freshclam --quiet --no-dns
  34. ADD ./server.* /etc/ssl/clamav-rest/
  35. COPY entrypoint.sh /usr/bin/
  36. RUN mkdir /etc/clamav/ && ln -s /etc/clamd.d/scan.conf /etc/clamav/clamd.conf
  37. EXPOSE 9000
  38. EXPOSE 9443
  39. ENV MAX_SCAN_SIZE=100M
  40. ENV MAX_FILE_SIZE=25M
  41. ENV MAX_RECURSION=16
  42. ENV MAX_FILES=10000
  43. ENV MAX_EMBEDDEDPE=10M
  44. ENV MAX_HTMLNORMALIZE=10M
  45. ENV MAX_HTMLNOTAGS=2M
  46. ENV MAX_SCRIPTNORMALIZE=5M
  47. ENV MAX_ZIPTYPERCG=1M
  48. ENV MAX_PARTITIONS=50
  49. ENV MAX_ICONSPE=100
  50. ENV PCRE_MATCHLIMIT=100000
  51. ENV PCRE_RECMATCHLIMIT=2000
  52. ENV SIGNATURE_CHECKS=24
  53. ENTRYPOINT [ "entrypoint.sh" ]