Skip to content

Commit

Permalink
clamav - adjust max filesize conditionally
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L. <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Jul 9, 2024
1 parent 3a691aa commit fb57cdf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
12 changes: 7 additions & 5 deletions Containers/clamav/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# syntax=docker/dockerfile:latest
# Probably from this file: https://github.com/Cisco-Talos/clamav-docker/blob/main/clamav/1.1/alpine/Dockerfile
# Probably from this file: https://github.com/Cisco-Talos/clamav-docker/blob/main/clamav/1.3/alpine/Dockerfile
FROM clamav/clamav:1.3.1-59

COPY clamav.conf /tmp/clamav.conf
COPY clamav.conf /clamav.conf
COPY --chmod=775 start.sh /start.sh

RUN set -ex; \
apk upgrade --no-cache -a; \
apk add --no-cache tzdata; \
cat /tmp/clamav.conf >> /etc/clamav/clamd.conf; \
rm /tmp/clamav.conf; \
apk add --no-cache tzdata bash; \
cat /clamav.conf >> /etc/clamav/clamd.conf; \
mkdir -p /var/run/clamav /run/lock; \
chown -R clamav:clamav /var/run/clamav /run/clamav /var/log/clamav /var/lock /run/lock; \
chmod 777 -R /var/run/clamav /run/clamav /var/log/clamav /var/lock /run/lock /tmp
Expand All @@ -18,3 +18,5 @@ VOLUME /var/lib/clamav
USER clamav

LABEL com.centurylinklabs.watchtower.enable="false"

ENTRYPOINT ["/start.sh"]
7 changes: 4 additions & 3 deletions Containers/clamav/clamav.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AIO settings
MaxDirectoryRecursion 30
MaxFileSize 100M
PCREMaxFileSize 100M
StreamMaxLength 100M
MaxFileSize 10G
PCREMaxFileSize 10G
StreamMaxLength 10G
11 changes: 11 additions & 0 deletions Containers/clamav/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if ! grep -q "AIO settings" /etc/clamav/clamd.conf; then
CADDYFILE="$(sed "s|10G|$UPLOAD_LIMIT|" /clamav.conf)"
echo "$CADDYFILE" >> /etc/clamav/clamd.conf
fi

# Call initial init
/init

exec "$@"
1 change: 1 addition & 0 deletions php/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@
"internal_port": "3310",
"environment": [
"TZ=%TIMEZONE%",
"UPLOAD_LIMIT=%NEXTCLOUD_UPLOAD_LIMIT%",
"CLAMD_STARTUP_TIMEOUT=90"
],
"volumes": [
Expand Down

0 comments on commit fb57cdf

Please sign in to comment.