From 35a5680f7442db42e213e3a5223aeb51073b0eed Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Sun, 7 Jul 2019 17:18:26 -0700 Subject: [PATCH] Fix Dockerfile. --- .travis.yml | 2 +- init/docker/Dockerfile | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cbb840d..da2fea15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ install: - make docker script: # Test built docker image. -- docker run golift/unifi-poller 2>&1 | grep -Eq "Loading Configuration File[:] /etc/unifi-poller/up.conf" +- docker run golift/unifi-poller:local 2>&1 | grep -Eq "Loading Configuration File[:] /etc/unifi-poller/up.conf" # test and build everything - rvm 2.0.0 do make release after_success: diff --git a/init/docker/Dockerfile b/init/docker/Dockerfile index 80c3cbab..00c9b9fe 100644 --- a/init/docker/Dockerfile +++ b/init/docker/Dockerfile @@ -1,13 +1,11 @@ # # building static go binary with Debian golang container # -ARG BINARY=unifi-poller -ARG REPO=github.com/davidnewhall/${BINARY} +ARG REPO=github.com/davidnewhall/unifi-poller FROM golang:stretch as builder ARG ARCH=amd64 ARG OS=linux -ARG BINARY ARG REPO RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${REPO} @@ -19,8 +17,8 @@ COPY . $GOPATH/src/${REPO} WORKDIR $GOPATH/src/${REPO} RUN dep ensure --vendor-only \ - && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} \ - && mv ${BINARY}.${ARCH}.${OS} ${BINARY} + && CGO_ENABLED=0 make unifi-poller.${ARCH}.${OS} \ + && mv unifi-poller.${ARCH}.${OS} unifi-poller # # creating container for run @@ -33,10 +31,9 @@ RUN dep ensure --vendor-only \ FROM scratch ARG REPO -ARG BINARY -COPY --from=builder /go/src/${REPO}/${BINARY} /${BINARY} -COPY --from=builder /go/src/${REPO}/examples/up.conf.example /etc/${BINARY}/up.conf +COPY --from=builder /go/src/${REPO}/unifi-poller /unifi-poller +COPY --from=builder /go/src/${REPO}/examples/up.conf.example /etc/unifi-poller}/up.conf -VOLUME [ "/etc/${BINARY}" ] -ENTRYPOINT [ "/${BINARY}" ] +VOLUME [ "/etc/unifi-poller" ] +ENTRYPOINT [ "/unifi-poller" ]