f4d6598308
- Include two Dockerfiles in the repo: one for Goreleaser and one for manual builds - Update the Goreleaser config to use it's own Dockerfile - The Dockerfile for manual builds uses a two step process to build the exporter - this way the base system does not need Go installed https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/114
30 lines
620 B
Docker
30 lines
620 B
Docker
FROM golang:1.20-buster AS build
|
|
|
|
# Create build workspace folder
|
|
WORKDIR /workspace
|
|
ADD . /workspace
|
|
|
|
# Install updates and build tools
|
|
RUN apt update --yes && \
|
|
apt install --yes build-essential
|
|
|
|
# Build the actual binary
|
|
RUN make build
|
|
|
|
# -- -- -- -- -- --
|
|
|
|
# Set up image to run the tool
|
|
FROM alpine
|
|
|
|
# Create main app folder to run from
|
|
WORKDIR /app
|
|
|
|
# Copy built binary from build image
|
|
COPY --from=build /workspace/fail2ban_exporter /app
|
|
|
|
# Setup a healthcheck
|
|
COPY health /app/health
|
|
RUN apk add curl
|
|
HEALTHCHECK --interval=10s --timeout=4s --retries=3 CMD /app/health
|
|
|
|
ENTRYPOINT ["/app/fail2ban_exporter"]
|