You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							27 lines
						
					
					
						
							717 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							27 lines
						
					
					
						
							717 B
						
					
					
				
								## 1. Build Server
							 | 
						|
								# Use Go 1.14
							 | 
						|
								FROM golang:1.14 AS build-server
							 | 
						|
								
							 | 
						|
								# Load repository into docker
							 | 
						|
								WORKDIR /project/
							 | 
						|
								COPY . .
							 | 
						|
								
							 | 
						|
								# Install build tools and dependencies
							 | 
						|
								RUN go generate ./...
							 | 
						|
								
							 | 
						|
								# Build server and tools (CGO disabled to make them 100% static)
							 | 
						|
								ENV CGO_ENABLED 0
							 | 
						|
								RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-server ./cmd/rpdata-server
							 | 
						|
								
							 | 
						|
								## 2. Distribute
							 | 
						|
								# Use alpine linux
							 | 
						|
								FROM alpine:3.12
							 | 
						|
								
							 | 
						|
								# Install certificates to enable HTTPS GET requests, and tzdata for log imports.
							 | 
						|
								RUN apk add --no-cache ca-certificates tzdata
							 | 
						|
								
							 | 
						|
								# Copy build files into final container
							 | 
						|
								COPY --from=build-server /binaries/* /usr/local/bin/
							 | 
						|
								
							 | 
						|
								# The server is the main entry point
							 | 
						|
								CMD ["/usr/local/bin/rpdata-server"]
							 |