Fix Dockerfile.
This commit is contained in:
		
							parent
							
								
									15dccc6504
								
							
						
					
					
						commit
						35a5680f74
					
				|  | @ -26,7 +26,7 @@ install: | ||||||
| - make docker | - make docker | ||||||
| script: | script: | ||||||
|   # Test built docker image. |   # 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 | # test and build everything | ||||||
| - rvm 2.0.0 do make release | - rvm 2.0.0 do make release | ||||||
| after_success: | after_success: | ||||||
|  |  | ||||||
|  | @ -1,13 +1,11 @@ | ||||||
| # | # | ||||||
| # 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/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 | ARG REPO | ||||||
| 
 | 
 | ||||||
| RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${REPO} | RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src/${REPO} | ||||||
|  | @ -19,8 +17,8 @@ COPY . $GOPATH/src/${REPO} | ||||||
| WORKDIR $GOPATH/src/${REPO} | WORKDIR $GOPATH/src/${REPO} | ||||||
| 
 | 
 | ||||||
| RUN dep ensure --vendor-only \ | RUN dep ensure --vendor-only \ | ||||||
|   && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} \ |   && CGO_ENABLED=0 make unifi-poller.${ARCH}.${OS} \ | ||||||
|   && mv ${BINARY}.${ARCH}.${OS} ${BINARY} |   && mv unifi-poller.${ARCH}.${OS} unifi-poller | ||||||
| 
 | 
 | ||||||
| # | # | ||||||
| # creating container for run | # creating container for run | ||||||
|  | @ -33,10 +31,9 @@ RUN dep ensure --vendor-only \ | ||||||
| 
 | 
 | ||||||
| FROM scratch | FROM scratch | ||||||
| ARG REPO | ARG REPO | ||||||
| ARG BINARY |  | ||||||
| 
 | 
 | ||||||
| COPY --from=builder /go/src/${REPO}/${BINARY} /${BINARY} | COPY --from=builder /go/src/${REPO}/unifi-poller /unifi-poller | ||||||
| COPY --from=builder /go/src/${REPO}/examples/up.conf.example /etc/${BINARY}/up.conf | COPY --from=builder /go/src/${REPO}/examples/up.conf.example /etc/unifi-poller}/up.conf | ||||||
| 
 | 
 | ||||||
| VOLUME [ "/etc/${BINARY}" ] | VOLUME [ "/etc/unifi-poller" ] | ||||||
| ENTRYPOINT [ "/${BINARY}" ] | ENTRYPOINT [ "/unifi-poller" ] | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue