2021-02-07 13:04:24 +00:00
|
|
|
# Using golang:latest instead of alpine because of issues with sqlite3
|
|
|
|
FROM golang:latest
|
|
|
|
|
2021-02-08 19:48:55 +00:00
|
|
|
# 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
|
2021-02-07 13:04:24 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2021-02-08 19:48:55 +00:00
|
|
|
# Move compiled binary to app folder and delete build folder
|
|
|
|
RUN mv /build/src/exporter /app/fail2ban-prometheus-exporter
|
|
|
|
RUN rm -rf /build
|
2021-02-07 13:04:24 +00:00
|
|
|
|
2021-02-08 19:48:55 +00:00
|
|
|
# Copy init script into main app folder and set as entry point
|
|
|
|
COPY docker/run.sh /app/
|
|
|
|
RUN chmod +x /app/*
|
2021-02-07 13:04:24 +00:00
|
|
|
ENTRYPOINT /app/run.sh
|