multi stage build for dicompot
rebuild fatt, glutton, hellpot, honeypots for alpine 3.19
bump glutton, hellpot, honeypots to latest master
This commit is contained in:
t3chn0m4g3
2024-03-05 19:50:35 +01:00
parent 519a101fdf
commit c45870594b
66 changed files with 464 additions and 225 deletions

View File

@ -1,45 +1,43 @@
FROM alpine:3.15 as builder
FROM golang:1.21-alpine as builder
#
# Include dist
COPY dist/ /root/dist/
#
# Setup apk
RUN apk -U --no-cache add \
build-base \
git \
go \
g++ \
iptables-dev \
libnetfilter_queue-dev \
libpcap-dev && \
build-base \
git \
g++ \
iptables-dev \
libpcap-dev && \
#
# Setup go, glutton
export GOPATH=/opt/go/ && \
export GO111MODULE=on && \
mkdir -p /opt/go && \
cd /opt/go/ && \
mkdir -p /opt/ && \
cd /opt/ && \
git clone https://github.com/mushorg/glutton && \
cd /opt/go/glutton/ && \
git checkout c25045b95b43ed9bfee89b2d14a50f5794a9cf2b && \
mv /root/dist/system.go /opt/go/glutton/ && \
cd /opt/glutton/ && \
git checkout c1204c65ce32bfdc0e08fb2a9abe89b3b8eeed62 && \
# git checkout c25045b95b43ed9bfee89b2d14a50f5794a9cf2b && \
cp /root/dist/system.go . && \
go mod download && \
make build && \
mv /root/dist/rules.yaml /opt/go/glutton/rules/
mv /root/dist/config.yaml /opt/glutton/config/
#
FROM alpine:3.17
FROM alpine:3.19
#
COPY --from=builder /opt/go/glutton/bin /opt/glutton/bin
COPY --from=builder /opt/go/glutton/config /opt/glutton/config
COPY --from=builder /opt/go/glutton/rules /opt/glutton/rules
COPY --from=builder /opt/glutton/bin /opt/glutton/bin
COPY --from=builder /opt/glutton/config /opt/glutton/config
COPY --from=builder /opt/glutton/rules /opt/glutton/rules
#
RUN apk -U --no-cache add \
iptables-dev \
libnetfilter_queue-dev \
libcap \
libpcap-dev && \
ln -s /sbin/xtables-legacy-multi /sbin/xtables-multi && \
iptables \
iptables-dev \
libnetfilter_queue-dev \
libcap \
libpcap-dev && \
setcap cap_net_admin,cap_net_raw=+ep /opt/glutton/bin/server && \
setcap cap_net_admin,cap_net_raw=+ep /sbin/xtables-legacy-multi && \
setcap cap_net_admin,cap_net_raw=+ep /sbin/xtables-nft-multi && \
#
# Setup user, groups and configs
addgroup -g 2000 glutton && \
@ -52,5 +50,5 @@ RUN apk -U --no-cache add \
#
# Start glutton
WORKDIR /opt/glutton
USER glutton:glutton
CMD exec bin/server -i $(/sbin/ip address show | /usr/bin/awk '/inet.*brd/{ print $NF; exit }') -l /var/log/glutton/glutton.log > /dev/null 2>&1
#USER glutton:glutton
CMD exec bin/server -d true -i $(/sbin/ip address show | /usr/bin/awk '/inet.*brd/{ print $NF; exit }') -l /var/log/glutton/glutton.log > /dev/null 2>&1