-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-build-buildpack
executable file
·45 lines (37 loc) · 1.61 KB
/
pre-build-buildpack
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
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE="dokku/$APP"
echo APP
echo ID
echo "-----> Installing clamav ..."
COMMAND=$(cat <<EOF
echo "-----> install requirements"
grep -v "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" /etc/apt/sources.list > temp.txt; mv temp.txt /etc/apt/sources.list
apt-get update
apt-get install -y software-properties-common
apt-get update
add-apt-repository multiverse
apt-get install -y clamav clamav-daemon
echo "-----> Update database"
wget -O /var/lib/clamav/main.cvd http://database.clamav.net/main.cvd && \
wget -O /var/lib/clamav/daily.cvd http://database.clamav.net/daily.cvd && \
wget -O /var/lib/clamav/bytecode.cvd http://database.clamav.net/bytecode.cvd && \
chown clamav:clamav /var/lib/clamav/*.cvd
echo "-----> Set permissions"
mkdir /var/run/clamav && \
chown clamav:clamav /var/run/clamav && \
chmod 777 /var/run/clamav
echo "-----> Update configuration"
sed -i 's/^Foreground .*$/Foreground true/g' /etc/clamav/clamd.conf && \
echo "TCPSocket 3310" >> /etc/clamav/clamd.conf && \
if ! [ -z $HTTPProxyServer ]; then echo "HTTPProxyServer $HTTPProxyServer" >> /etc/clamav/freshclam.conf; fi && \
if ! [ -z $HTTPProxyPort ]; then echo "HTTPProxyPort $HTTPProxyPort" >> /etc/clamav/freshclam.conf; fi && \
sed -i 's/^Foreground .*$/Foreground true/g' /etc/clamav/freshclam.conf
sleep 1 # wait so that docker run has not exited before docker attach
EOF
)
id=$(docker run -d $IMAGE /bin/bash -e -c "$COMMAND")
#enable logs
docker attach $id
test $(docker wait $id) -eq 0
docker commit $id $IMAGE > /dev/null