fix docker image + install whitelists on build (#968)

* fix docker image + install whitelists on build
This commit is contained in:
he2ss 2021-09-13 10:48:48 +02:00 committed by GitHub
parent e929ba16de
commit ff400c9bca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -10,8 +10,7 @@ COPY . .
RUN SYSTEM="docker" make release
RUN cd crowdsec-v* && ./wizard.sh --docker-mode && cd -
RUN cscli hub update && cscli collections install crowdsecurity/linux
RUN cscli hub update && cscli collections install crowdsecurity/linux && cscli parsers install crowdsecurity/whitelists
FROM alpine:latest
RUN apk update --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community && apk add --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community tzdata yq
COPY --from=build /etc/crowdsec /etc/crowdsec

View file

@ -4,8 +4,8 @@
if [ "$DISABLE_AGENT" == "" ] ; then
echo "Check if the container has already been started (ignore if agent is disabled)"
cscli machines list | grep localhost
if [ $? == 1 ]; then
cscli lapi register --machine localhost
if [ "$?" == 1 ]; then
cscli machines add localhost --auto
fi
if [ "$AGENT_USERNAME" != "" ] && [ "$AGENT_PASSWORD" != "" ] && [ "$LOCAL_API_URL" != "" ] ; then
echo "set up lapi credentials for agent"
@ -46,6 +46,7 @@ fi
## Install collections, parsers & scenarios
cscli hub update
cscli collections upgrade crowdsecurity/linux || true
cscli parsers upgrade crowdsecurity/whitelists || true
if [ "$COLLECTIONS" != "" ]; then
cscli collections install $COLLECTIONS
fi