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 $< | ||||
| 
 | ||||
| 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.
 | ||||
| package_build_linux: readme man linux | ||||
|  |  | |||
|  | @ -1,22 +1,26 @@ | |||
| # | ||||
| # building static go binary with Debian golang container | ||||
| # | ||||
| ARG BINARY=unifi-poller | ||||
| ARG REPO=github.com/davidnewhall/${BINARY} | ||||
| 
 | ||||
| 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/github.com/davidnewhall | ||||
| RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${REPO} | ||||
| RUN apt-get update \ | ||||
|   && apt-get install -y curl  \ | ||||
|   && curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||||
| 
 | ||||
| COPY . $GOPATH/src/github.com/davidnewhall/unifi-poller | ||||
| WORKDIR $GOPATH/src/github.com/davidnewhall/unifi-poller | ||||
| COPY . $GOPATH/src/${REPO} | ||||
| WORKDIR $GOPATH/src/${REPO} | ||||
| 
 | ||||
| RUN dep ensure --vendor-only \ | ||||
|   && CGO_ENABLED=0 make unifi-poller.${ARCH}.${OS} \ | ||||
|   && mv unifi-poller.${ARCH}.${OS} unifi-poller | ||||
|   && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} \ | ||||
|   && mv ${BINARY}.${ARCH}.${OS} ${BINARY} | ||||
| 
 | ||||
| # | ||||
| # creating container for run | ||||
|  | @ -28,9 +32,11 @@ RUN dep ensure --vendor-only \ | |||
| # | ||||
| 
 | ||||
| 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/github.com/davidnewhall/unifi-poller/examples/up.conf.example /etc/unifi-poller/up.conf | ||||
| COPY --from=builder /go/src/${REPO}/${BINARY} /${BINARY} | ||||
| COPY --from=builder /go/src/${REPO}/examples/up.conf.example /etc/${BINARY}/up.conf | ||||
| 
 | ||||
| VOLUME [ "/etc/unifi-poller" ] | ||||
| ENTRYPOINT [ "/unifi-poller" ] | ||||
| VOLUME [ "/etc/${BINARY}" ] | ||||
| ENTRYPOINT [ "/${BINARY}" ] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue