From d8cc0c8477722914050f098fae0812dafeb5760a Mon Sep 17 00:00:00 2001 From: Yi Sheng Yap Date: Wed, 13 Feb 2019 11:20:27 +0800 Subject: [PATCH] Update Dockerfile, remove multibuild as OpenShift build does not support --- Dockerfile | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index d74cf4d..4fadc82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ -# build stage -FROM golang:alpine AS build-env -ADD . /go/src/github.com/niilo/clamav-rest/ -RUN cd /go/src/github.com/niilo/clamav-rest && go build -v +FROM golang:alpine -# dockerize stage -FROM alpine -MAINTAINER Niilo Ursin +# Update +RUN apk update upgrade; +# Set timezone to Singapore +RUN apk add tzdata +RUN mv /etc/localtime /etc/localtime.utc && \ + ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime + + +# Install ClamAV RUN apk --no-cache add clamav clamav-libunrar \ && mkdir /run/clamav \ && chown clamav:clamav /run/clamav @@ -17,8 +20,14 @@ RUN sed -i 's/^#Foreground .*$/Foreground true/g' /etc/clamav/clamd.conf \ RUN freshclam --quiet +# Build go package +ADD . /go/src/clamav-rest/ +RUN cd /go/src/clamav-rest && go build -v + + COPY entrypoint.sh /usr/bin/ -COPY --from=build-env /go/src/github.com/niilo/clamav-rest/clamav-rest /usr/bin/ +RUN mv /go/src/clamav-rest/clamav-rest /usr/bin/ && rm -Rf /go/src/clamav-rest + EXPOSE 9000