generic Dockerfile.
This commit is contained in:
parent
4de8dd2f2e
commit
8b272fb8ff
2
Makefile
2
Makefile
|
|
@ -261,7 +261,7 @@ $(BINARY)_$(VERSION)-$(ITERATION)_armhf.deb: package_build_linux_armhf check_fpm
|
||||||
--chdir $<
|
--chdir $<
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
docker build -f init/docker/Dockerfile -t $(DHUSER)/$(BINARY) .
|
docker build -f init/docker/Dockerfile -t $(DHUSER)/$(BINARY):local .
|
||||||
|
|
||||||
# Build an environment that can be packaged for linux.
|
# Build an environment that can be packaged for linux.
|
||||||
package_build_linux: readme man linux
|
package_build_linux: readme man linux
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,26 @@
|
||||||
#
|
#
|
||||||
# building static go binary with Debian golang container
|
# building static go binary with Debian golang container
|
||||||
#
|
#
|
||||||
|
ARG BINARY=unifi-poller
|
||||||
|
ARG REPO=github.com/davidnewhall/${BINARY}
|
||||||
|
|
||||||
FROM golang:stretch as builder
|
FROM golang:stretch as builder
|
||||||
ARG ARCH=amd64
|
ARG ARCH=amd64
|
||||||
ARG OS=linux
|
ARG OS=linux
|
||||||
|
ARG BINARY
|
||||||
|
ARG REPO
|
||||||
|
|
||||||
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/github.com/davidnewhall
|
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${REPO}
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y curl \
|
&& apt-get install -y curl \
|
||||||
&& curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
&& curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||||
|
|
||||||
COPY . $GOPATH/src/github.com/davidnewhall/unifi-poller
|
COPY . $GOPATH/src/${REPO}
|
||||||
WORKDIR $GOPATH/src/github.com/davidnewhall/unifi-poller
|
WORKDIR $GOPATH/src/${REPO}
|
||||||
|
|
||||||
RUN dep ensure --vendor-only \
|
RUN dep ensure --vendor-only \
|
||||||
&& CGO_ENABLED=0 make unifi-poller.${ARCH}.${OS} \
|
&& CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} \
|
||||||
&& mv unifi-poller.${ARCH}.${OS} unifi-poller
|
&& mv ${BINARY}.${ARCH}.${OS} ${BINARY}
|
||||||
|
|
||||||
#
|
#
|
||||||
# creating container for run
|
# creating container for run
|
||||||
|
|
@ -28,9 +32,11 @@ RUN dep ensure --vendor-only \
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
ARG REPO
|
||||||
|
ARG BINARY
|
||||||
|
|
||||||
COPY --from=builder /go/src/github.com/davidnewhall/unifi-poller/unifi-poller /unifi-poller
|
COPY --from=builder /go/src/${REPO}/${BINARY} /${BINARY}
|
||||||
COPY --from=builder /go/src/github.com/davidnewhall/unifi-poller/examples/up.conf.example /etc/unifi-poller/up.conf
|
COPY --from=builder /go/src/${REPO}/examples/up.conf.example /etc/${BINARY}/up.conf
|
||||||
|
|
||||||
VOLUME [ "/etc/unifi-poller" ]
|
VOLUME [ "/etc/${BINARY}" ]
|
||||||
ENTRYPOINT [ "/unifi-poller" ]
|
ENTRYPOINT [ "/${BINARY}" ]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue