Fix Dockerfile.
This commit is contained in:
parent
15dccc6504
commit
35a5680f74
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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" ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue