2023-10-27 08:01:41 +02:00
|
|
|
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
|
2023-09-07 23:16:20 +02:00
|
|
|
FROM alpine
|
2021-03-27 18:29:28 +01:00
|
|
|
|
2021-02-08 20:48:55 +01:00
|
|
|
# Create main app folder to run from
|
2021-02-07 14:04:24 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
2023-10-27 08:01:41 +02:00
|
|
|
# Copy built binary from build image
|
|
|
|
COPY --from=build /workspace/fail2ban_exporter /app
|
2023-09-07 23:16:20 +02:00
|
|
|
|
|
|
|
# Setup a healthcheck
|
2023-09-09 08:15:23 +02:00
|
|
|
COPY health /app/health
|
2023-09-07 23:16:20 +02:00
|
|
|
RUN apk add curl
|
2023-09-09 08:15:23 +02:00
|
|
|
HEALTHCHECK --interval=10s --timeout=4s --retries=3 CMD /app/health
|
2021-02-07 14:04:24 +01:00
|
|
|
|
2022-02-20 09:46:40 +01:00
|
|
|
ENTRYPOINT ["/app/fail2ban_exporter"]
|