You've already forked prometheus-fail2ban-exporter
							
							Update the project Dockerfile to compile the tool during the docker build instead of assuming the goreleaser tool was run previously. This allows for custom data to be set in the compiled tool (e.g. compiled by docker) and removes the dependency on another build step. Update the Makefile to include a new command to build the tool for docker which sets the version data correctly. Rename the docker commands to follow the `docker/build-...` format to avoid confusion with the build commands.
		
			
				
	
	
		
			25 lines
		
	
	
		
			639 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			639 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
# Using golang:latest instead of alpine because of issues with sqlite3
 | 
						|
FROM golang:latest
 | 
						|
 | 
						|
# Create build folder to compile tool
 | 
						|
WORKDIR /build
 | 
						|
 | 
						|
# Copy source files to build folder and link to the /go folder
 | 
						|
COPY . /build
 | 
						|
RUN ln -s /go/src/ /build/src
 | 
						|
 | 
						|
# Compile the tool using a Make command
 | 
						|
RUN make build/docker
 | 
						|
 | 
						|
# Create main app folder to run from
 | 
						|
WORKDIR /app
 | 
						|
 | 
						|
# Move compiled binary to app folder and delete build folder
 | 
						|
RUN mv /build/src/exporter /app/fail2ban-prometheus-exporter
 | 
						|
RUN rm -rf /build
 | 
						|
 | 
						|
# Copy init script into main app folder and set as entry point
 | 
						|
COPY docker/run.sh /app/
 | 
						|
RUN chmod +x /app/*
 | 
						|
ENTRYPOINT /app/run.sh
 |