Skip to content

Commit

Permalink
docker: distribute geoip db in slim image (#2920)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc authored Apr 3, 2024
1 parent 63bd31b commit 26bcd09
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
11 changes: 2 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ COPY --from=build /go/bin/yq /usr/local/bin/crowdsec /usr/local/bin/cscli /usr/l
COPY --from=build /etc/crowdsec /staging/etc/crowdsec
COPY --from=build /go/src/crowdsec/docker/docker_start.sh /
COPY --from=build /go/src/crowdsec/docker/config.yaml /staging/etc/crowdsec/config.yaml
COPY --from=build /var/lib/crowdsec /staging/var/lib/crowdsec
RUN yq -n '.url="http://0.0.0.0:8080"' | install -m 0600 /dev/stdin /staging/etc/crowdsec/local_api_credentials.yaml

ENTRYPOINT /bin/bash /docker_start.sh

FROM slim as plugins
FROM slim as full

# Due to the wizard using cp -n, we have to copy the config files directly from the source as -n does not exist in busybox cp
# The files are here for reference, as users will need to mount a new version to be actually able to use notifications
Expand All @@ -60,11 +61,3 @@ COPY --from=build \
/staging/etc/crowdsec/notifications/

COPY --from=build /usr/local/lib/crowdsec/plugins /usr/local/lib/crowdsec/plugins

FROM slim as geoip

COPY --from=build /var/lib/crowdsec /staging/var/lib/crowdsec

FROM plugins as full

COPY --from=build /var/lib/crowdsec /staging/var/lib/crowdsec
2 changes: 1 addition & 1 deletion docker/test/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CROWDSEC_TEST_VERSION="dev"
# All of the following flavors will be tested when using the "flavor" fixture
CROWDSEC_TEST_FLAVORS="full"
# CROWDSEC_TEST_FLAVORS="full,slim,debian"
# CROWDSEC_TEST_FLAVORS="full,slim,debian,geoip,plugins-debian-slim,debian-geoip,debian-plugins"
# CROWDSEC_TEST_FLAVORS="full,slim,debian,debian-slim"

# network to use
CROWDSEC_TEST_NETWORK="net-test"
Expand Down
2 changes: 1 addition & 1 deletion docker/test/tests/test_flavors.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_flavor_content(crowdsec, flavor):
x = cs.cont.exec_run(
'ls -1 /usr/local/lib/crowdsec/plugins/')
stdout = x.output.decode()
if 'slim' in flavor or 'geoip' in flavor:
if 'slim' in flavor:
# the exact return code and full message depend
# on the 'ls' implementation (busybox vs coreutils)
assert x.exit_code != 0
Expand Down

0 comments on commit 26bcd09

Please sign in to comment.