Skip to content

Commit 05fd355

Browse files
committed
Reworked to match current build deployment.
Expects crowdsec to be already installed into the base image.
1 parent 6d116a2 commit 05fd355

File tree

4 files changed

+23
-63
lines changed

4 files changed

+23
-63
lines changed

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARG TARGETPLATFORM
99
ARG BUILD_VERSION
1010
ARG BUILD_COMMIT
1111
ARG BUILD_DATE
12+
ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION
1213

1314
ENV SUPPRESS_NO_CONFIG_WARNING=1 \
1415
S6_FIX_ATTRS_HIDDEN=1 \

docker/rootfs/etc/cont-init.d/99_crowdsec-openresty-bouncer.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
set -e # Exit immediately if a command exits with a non-zero status.
4+
5+
mkdir -p /data/crowdsec
6+
if [ -f /data/crowdsec/crowdsec-openresty-bouncer.conf ]; then
7+
echo "Patch crowdsec-openresty-bouncer.conf .."
8+
sed "s/=.*//g" /data/crowdsec/crowdsec-openresty-bouncer.conf > /tmp/crowdsec.conf.raw
9+
sed "s/=.*//g" /defaults/crowdsec/config_example.conf > /tmp/config_example.conf.raw
10+
if grep -vf /tmp/crowdsec.conf.raw /tmp/config_example.conf.raw ; then
11+
grep -vf /tmp/crowdsec.conf.raw /tmp/config_example.conf.raw > /tmp/config_example.newvals
12+
cp /data/crowdsec/crowdsec-openresty-bouncer.conf /data/crowdsec/crowdsec-openresty-bouncer.conf.bak
13+
grep -f /tmp/config_example.newvals /defaults/crowdsec/config_example.conf >> /data/crowdsec/crowdsec-openresty-bouncer.conf
14+
fi
15+
else
16+
echo "Deploy new crowdsec-openresty-bouncer.conf .."
17+
cp /defaults/crowdsec/config_example.conf /data/crowdsec/crowdsec-openresty-bouncer.conf
18+
fi
19+
echo "Deploy Templates .."
20+
sed -i 's|/defaults/crowdsec/templates|/data/crowdsec/templates|' /data/crowdsec/crowdsec-openresty-bouncer.conf
21+
cp -r /defaults/crowdsec/templates/* /data/crowdsec/templates/

0 commit comments

Comments
 (0)