docker updates

This commit is contained in:
David Newhall II
2019-07-06 19:45:23 -07:00
parent e2621248e5
commit 369cf612c6
7 changed files with 49 additions and 15 deletions
+5 -6
View File
@@ -1,10 +1,10 @@
#
# building static go binary with Debian golang container
#
ARG ARCH=amd64
FROM golang:stretch as builder
ARG ARCH
ARG ARCH=amd64
ARG OS=linux
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/github.com/davidnewhall
RUN apt-get update \
@@ -15,7 +15,8 @@ COPY . $GOPATH/src/github.com/davidnewhall/unifi-poller
WORKDIR $GOPATH/src/github.com/davidnewhall/unifi-poller
RUN dep ensure --vendor-only \
&& CGO_ENABLED=0 make unifi-poller.${ARCH}.linux
&& CGO_ENABLED=0 make unifi-poller.${ARCH}.${OS}
&& mv unifi-poller.${ARCH}.${OS} unifi-poller
#
# creating container for run
@@ -25,10 +26,8 @@ RUN dep ensure --vendor-only \
#
# by using "-e UNIFI_PASSWORD=your-secret-pasword" you can avoid this configuration in the config file
#
FROM scratch
ARG ARCH
COPY --from=builder /go/src/github.com/davidnewhall/unifi-poller/unifi-poller.${ARCH}.linux /unifi-poller
COPY --from=builder /go/src/github.com/davidnewhall/unifi-poller/unifi-poller /unifi-poller
COPY --from=builder /go/src/github.com/davidnewhall/unifi-poller/examples/up.conf.example /etc/unifi-poller/up.conf
VOLUME [ "/etc/unifi-poller" ]