-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Dockerfile
53 lines (45 loc) · 1.28 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# syntax=docker/dockerfile:1
ARG FAIL2BAN_VERSION=1.1.0
ARG ALPINE_VERSION=3.19
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS fail2ban-src
RUN apk add --no-cache git
WORKDIR /src/fail2ban
RUN git init . && git remote add origin "https://github.com/fail2ban/fail2ban.git"
ARG FAIL2BAN_VERSION
RUN git fetch origin "${FAIL2BAN_VERSION}" && git checkout -q FETCH_HEAD
FROM alpine:${ALPINE_VERSION}
RUN --mount=from=fail2ban-src,source=/src/fail2ban,target=/tmp/fail2ban,rw \
apk --update --no-cache add \
bash \
curl \
grep \
ipset \
iptables \
iptables-legacy \
kmod \
nftables \
openssh-client-default \
python3 \
py3-dnspython \
py3-inotify \
ssmtp \
tzdata \
wget \
whois \
&& apk --update --no-cache add -t build-dependencies \
build-base \
py3-pip \
py3-setuptools \
python3-dev \
&& cd /tmp/fail2ban \
&& 2to3 -w --no-diffs bin/* fail2ban \
&& python3 setup.py install --without-tests \
&& apk del build-dependencies \
&& rm -rf /etc/fail2ban/jail.d /root/.cache
COPY entrypoint.sh /entrypoint.sh
ENV TZ="UTC"
VOLUME [ "/data" ]
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "fail2ban-server", "-f", "-x", "-v", "start" ]
HEALTHCHECK --interval=10s --timeout=5s \
CMD fail2ban-client ping || exit 1