Skip to content

Provide a Docker imageΒ #95

@laurentgoudet

Description

@laurentgoudet

Most (all?) bouncers seem to be available as a Docker image, but not this one. Arguably depending on what the custom script is doing, a custom image will still need to be built (to install dependencies), but having an official image to extend would make the process easier.

In the meantime if anyone having the same issue, here's a sample Dockerfile that works for me (the custom script just needs to be mounted to the bin_path value in the YAML config):

ARG VERSION=v0.0.17-rc6

FROM golang:1.21.4 as build-stage
ARG VERSION
WORKDIR /app

RUN git clone --branch $VERSION --depth 1 https://github.com/crowdsecurity/cs-custom-bouncer.git
WORKDIR /app/cs-custom-bouncer
RUN CGO_ENABLED=0 GOOS=linux make release

FROM ubuntu:22.04
ARG VERSION
WORKDIR /

RUN mkdir -p /etc/crowdsec/bouncers
COPY --from=build-stage /app/cs-custom-bouncer/crowdsec-custom-bouncer-$VERSION/crowdsec-custom-bouncer \
    /usr/bin/crowdsec-custom-bouncer
COPY --from=build-stage /app/cs-custom-bouncer/crowdsec-custom-bouncer-$VERSION/config/crowdsec-custom-bouncer.yaml \
    /etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml

CMD ["/usr/bin/crowdsec-custom-bouncer", "-c", "/etc/crowdsec/bouncers/crowdsec-custom-bouncer.yaml"]

Alternatively just providing that sample Dockerfile in the docs would be nice

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions