-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
97 lines (77 loc) · 2.32 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
FROM alpine:latest
MAINTAINER Obuno "obuno@protonmail.com"
ENV cicapBaseVersion="0.6.3" cicapModuleVersion="0.5.7"
WORKDIR /
# 1. create needed directories
RUN mkdir -p /tmp/install && mkdir -p /opt/c-icap && mkdir -p /var/log/c-icap/ && mkdir -p /run/clamav && \
cd /tmp/install
# 2. install needed packages
RUN apk --update --no-cache add \
autoconf \
automake \
bash \
bzip2 \
bzip2-dev \
zlib \
zlib-dev \
curl \
tar \
gcc \
make \
g++ \
git \
libatomic \
libtool \
clamav \
clamav-libunrar \
iproute2 \
htop \
python3 \
py3-pip
# 3. download c_icap, c_icap modules and install them
RUN curl --silent --location --remote-name "http://downloads.sourceforge.net/project/c-icap/c-icap/0.6.x/c_icap-${cicapBaseVersion}.tar.gz" && \
curl --silent --location --remote-name "https://sourceforge.net/projects/c-icap/files/c-icap-modules/0.5.x/c_icap_modules-${cicapModuleVersion}.tar.gz" && \
tar -xzf "c_icap-${cicapBaseVersion}.tar.gz" && tar -xzf "c_icap_modules-${cicapModuleVersion}.tar.gz" && cd c_icap-${cicapBaseVersion} && \
sed -i 's/HTTP\/1.0/HTTP\/1.1/g' utils/c-icap-client.c && \
sed -i 's/HTTP\/1.0/HTTP\/1.1/g' info.c && \
/bin/sh RECONF && \
./configure --quiet --prefix=/opt/c-icap --enable-large-files && \
make && make install && \
cd ../c_icap_modules-${cicapModuleVersion}/ && ./configure --quiet --with-c-icap=/opt/c-icap --prefix=/opt/c-icap && \
make && make install
# 4. compile SquidClamAV
RUN git clone https://github.com/darold/squidclamav.git && \
cd squidclamav/ && \
./configure --with-c-icap=/opt/c-icap && \
# Reaplace HTTP 1.0 with HTTP 1.1
sed -i 's/HTTP\/1.0/HTTP\/1.1/g' src/squidclamav.c && \
make && make install
# 5. configure clamav
RUN chown clamav:clamav /run/clamav
# 6. clean up
RUN cd / && rm -rf /tmp/install && \
apk del \
autoconf \
automake \
bzip2 \
bzip2-dev \
zlib \
zlib-dev \
curl \
tar \
gcc \
make \
g++ && \
rm -rf /opt/c-icap/etc/*.default
ADD ./opt /opt
ADD ./etc /etc
RUN chmod a+x /etc/periodic/hourly/*
RUN chmod a+x /etc/periodic/daily/*
COPY startup.sh /app/startup.sh
RUN chmod a+x /app/*.sh
COPY ./app/requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip install --upgrade pip --break-system-packages
RUN pip install -r requirements.txt --break-system-packages
COPY ./app /app
CMD ["/bin/sh","-c","/app/startup.sh"]