| 
						
						
						
					 | 
				
				 | 
				
					@ -0,0 +1,29 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## 1. Build Server | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Use Go 1.11 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM golang:1.11 AS build | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Load repository into docker | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /go/src/git.aiterp.net/rpdata/logbot3/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY . . | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN rm -rf ./vendor | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Load and run dependencies | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN go get -u github.com/golang/dep/cmd/dep | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN dep ensure | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Build server and tools (CGO disabled to make them 100% static) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					ENV CGO_ENABLED 0 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/logbot3 . | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## 2. Distribute | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Use alpine linux | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM alpine:3.8 as main-dist | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Install certificates to enable HTTPS GET requests | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN apk add --no-cache ca-certificates | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Copy build files into final container | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=build /binaries/* /usr/local/bin/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# The server is the main entry point | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					CMD ["/usr/local/bin/logbot3"] |