modify to single docker image for clamav-rest
This commit is contained in:
parent
6c8586f48e
commit
5784f5fc5f
2 changed files with 39 additions and 8 deletions
23
Dockerfile
23
Dockerfile
|
@ -1,12 +1,19 @@
|
||||||
FROM golang:1.3
|
FROM alpine
|
||||||
|
MAINTAINER Niilo Ursin <niilo.ursin+nospam_github@gmail.com>
|
||||||
|
|
||||||
ADD . /go/src/github.com/osterzel/clamrest
|
RUN apk --no-cache add clamav clamav-libunrar \
|
||||||
|
&& mkdir /run/clamav \
|
||||||
|
&& chown clamav:clamav /run/clamav
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/osterzel/clamrest
|
RUN sed -i 's/^#Foreground .*$/Foreground true/g' /etc/clamav/clamd.conf \
|
||||||
RUN go get
|
&& sed -i 's/^#TCPSocket .*$/TCPSocket 3310/g' /etc/clamav/clamd.conf \
|
||||||
RUN go install github.com/osterzel/clamrest
|
&& sed -i 's/^#Foreground .*$/Foreground true/g' /etc/clamav/freshclam.conf
|
||||||
RUN rm -rf /go/src/github.com/osterzel/clamrest
|
|
||||||
|
|
||||||
ENTRYPOINT /go/bin/clamrest
|
RUN freshclam --quiet
|
||||||
|
|
||||||
EXPOSE 8080
|
COPY entrypoint.sh /usr/bin/
|
||||||
|
COPY clamav-rest /usr/bin/
|
||||||
|
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
ENTRYPOINT [ "entrypoint.sh" ]
|
24
entrypoint.sh
Executable file
24
entrypoint.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
freshclam -d &
|
||||||
|
clamd &
|
||||||
|
sleep 20
|
||||||
|
/usr/bin/clamav-rest &
|
||||||
|
|
||||||
|
pids=`jobs -p`
|
||||||
|
|
||||||
|
exitcode=0
|
||||||
|
|
||||||
|
terminate() {
|
||||||
|
for pid in $pids; do
|
||||||
|
if ! kill -0 $pid 2>/dev/null; then
|
||||||
|
wait $pid
|
||||||
|
exitcode=$?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
kill $pids 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
trap terminate CHLD
|
||||||
|
wait
|
||||||
|
|
||||||
|
exit $exitcode
|
Loading…
Add table
Reference in a new issue