Clamav dockerfile simplification
- Locked to specific release. - Fewer layers. - Size reduction of 49 MB.
This commit is contained in:
		@@ -1,30 +1,30 @@
 | 
			
		||||
FROM alpine
 | 
			
		||||
FROM alpine:3.6
 | 
			
		||||
 | 
			
		||||
LABEL maintainer "https://m-ko.de Markus Kosmal <code@cnfg.io>"
 | 
			
		||||
 | 
			
		||||
RUN apk add -U --no-cache clamav clamav-libunrar clamav-daemon bash curl
 | 
			
		||||
# Add scripts
 | 
			
		||||
COPY dl_files.sh bootstrap.sh ./
 | 
			
		||||
 | 
			
		||||
# initial update of av databases
 | 
			
		||||
COPY dl_files.sh /dl_files.sh
 | 
			
		||||
RUN chmod +x /dl_files.sh
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
# pre-download defintions
 | 
			
		||||
RUN set -ex; \
 | 
			
		||||
	/dl_files.sh && \
 | 
			
		||||
	apk del curl
 | 
			
		||||
 | 
			
		||||
# permission juggling
 | 
			
		||||
RUN mkdir -p /run/clamav && \
 | 
			
		||||
	chown clamav:clamav /run/clamav && \
 | 
			
		||||
	chmod 750 /run/clamav
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
# port provision
 | 
			
		||||
# Port provision
 | 
			
		||||
EXPOSE 3310
 | 
			
		||||
 | 
			
		||||
# av daemon bootstrapping
 | 
			
		||||
COPY bootstrap.sh /
 | 
			
		||||
# AV daemon bootstrapping
 | 
			
		||||
CMD ["/bootstrap.sh"]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user