install coreutils under alpine; do not copy notification configuration (#1044)

under Docker; assume systemctl is not running if it does not exist
This commit is contained in:
mmetc 2021-11-03 16:56:44 +01:00 committed by GitHub
parent 8b0527bf9d
commit a4998913d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -4,7 +4,8 @@ FROM golang:${GOVERSION}-alpine AS build
WORKDIR /go/src/crowdsec
RUN apk update && apk add --no-cache git jq gcc libc-dev make bash gettext binutils-gold
# wizard.sh requires GNU coreutils
RUN apk update && apk add --no-cache git jq gcc libc-dev make bash gettext binutils-gold coreutils
COPY . .

View file

@ -460,7 +460,7 @@ install_bins() {
log_dbg "Installing crowdsec binaries"
install -v -m 755 -D "${CROWDSEC_BIN}" "${CROWDSEC_BIN_INSTALLED}" 1> /dev/null || exit
install -v -m 755 -D "${CSCLI_BIN}" "${CSCLI_BIN_INSTALLED}" 1> /dev/null || exit
systemctl is-active --quiet crowdsec
which systemctl && systemctl is-active --quiet crowdsec
if [ $? -eq 0 ]; then
systemctl stop crowdsec
fi
@ -492,13 +492,14 @@ install_plugins(){
mkdir -p /etc/crowdsec/notifications
cp ${SLACK_PLUGIN_BINARY} ${CROWDSEC_PLUGIN_DIR}
cp -n ${SLACK_PLUGIN_CONFIG} /etc/crowdsec/notifications
cp ${SPLUNK_PLUGIN_BINARY} ${CROWDSEC_PLUGIN_DIR}
cp -n ${SPLUNK_PLUGIN_CONFIG} /etc/crowdsec/notifications
cp ${HTTP_PLUGIN_BINARY} ${CROWDSEC_PLUGIN_DIR}
cp -n ${HTTP_PLUGIN_CONFIG} /etc/crowdsec/notifications
if [[ ${DOCKER_MODE} == "false" ]]; then
cp -n ${SLACK_PLUGIN_CONFIG} /etc/crowdsec/notifications/
cp -n ${SPLUNK_PLUGIN_CONFIG} /etc/crowdsec/notifications/
cp -n ${HTTP_PLUGIN_CONFIG} /etc/crowdsec/notifications/
fi
}
check_running_bouncers() {