Browse Source

Clamav dockerfile simplification

- Locked to specific release.
- Fewer layers.
- Size reduction of 49 MB.
TBK 8 years ago
parent
commit
2d0c4db2a5
1 changed files with 23 additions and 23 deletions
  1. 23 23
      data/Dockerfiles/clamav/Dockerfile

+ 23 - 23
data/Dockerfiles/clamav/Dockerfile

@@ -1,30 +1,30 @@
-FROM alpine
-LABEL maintainer "https://m-ko.de Markus Kosmal <code@cnfg.io>"
-
-RUN apk add -U --no-cache clamav clamav-libunrar clamav-daemon bash curl
+FROM alpine:3.6
 
 
-# initial update of av databases
-COPY dl_files.sh /dl_files.sh
-RUN chmod +x /dl_files.sh
-
-# pre-download defintions
-RUN set -ex; \
-	/dl_files.sh && \
-	apk del curl
+LABEL maintainer "https://m-ko.de Markus Kosmal <code@cnfg.io>"
 
 
-# permission juggling
-RUN mkdir -p /run/clamav && \
-	chown clamav:clamav /run/clamav && \
-	chmod 750 /run/clamav
+# Add scripts
+COPY dl_files.sh bootstrap.sh ./
 
 
-# av configuration update
-RUN sed -i 's/^Foreground .*$/Foreground true/g' /etc/clamav/clamd.conf && \
-	echo "TCPSocket 3310" >> /etc/clamav/clamd.conf && \
-	sed -i 's/^Foreground .*$/Foreground true/g' /etc/clamav/freshclam.conf
+# Install Dependencies
+RUN apk add --update \
+&& apk add --no-cache clamav clamav-libunrar curl bash \
+\
+# Update AV databases
+&& chmod +x dl_files.sh \
+&& set -ex; /dl_files.sh \
+\
+# Setup run
+&& mkdir /run/clamav \
+&& chown clamav:clamav /run/clamav \
+&& chmod 750 /run/clamav \
+\
+# AV configuration
+&& sed -i '/Foreground yes/s/^#//g' /etc/clamav/clamd.conf \
+&& sed -i '/TCPSocket 3310/s/^#//g' /etc/clamav/clamd.conf \
+&& sed -i '/Foreground yes/s/^#//g' /etc/clamav/freshclam.conf
 
 
-# port provision
+# Port provision
 EXPOSE 3310
 EXPOSE 3310
 
 
-# av daemon bootstrapping
-COPY bootstrap.sh /
+# AV daemon bootstrapping
 CMD ["/bootstrap.sh"]
 CMD ["/bootstrap.sh"]