Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed config file and hard linked it into the nginx conf #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG BUILD_ENV=git
FROM openresty/openresty:alpine-fat as with_deps
FROM openresty/openresty:alpine-fat AS with_deps
RUN luarocks install lua-resty-http

FROM with_deps as git
FROM with_deps AS git
ARG BUILD_ENV=git
RUN if [ "$BUILD_ENV" == "git" ]; then apk add --no-cache git; fi
RUN if [ "$BUILD_ENV" == "git" ]; then git clone https://github.com/crowdsecurity/lua-cs-bouncer.git ; fi

FROM with_deps as local
FROM with_deps AS local
RUN if [ "$BUILD_ENV" == "local" ]; then COPY ./lua-cs-bouncer/ lua-cs-bouncer; fi

FROM ${BUILD_ENV}
Expand All @@ -17,8 +17,10 @@ RUN cp -R lua-cs-bouncer/templates/* /var/lib/crowdsec/lua/templates/
RUN cp lua-cs-bouncer/config_example.conf /etc/crowdsec/bouncers/crowdsec-openresty-bouncer.conf
RUN rm -rf ./lua-cs-bouncer/
COPY ./openresty /tmp
RUN SSL_CERTS_PATH=/etc/ssl/certs/ca-certificates.crt envsubst '$SSL_CERTS_PATH' < /tmp/crowdsec_openresty.conf > /etc/nginx/conf.d/crowdsec_openresty.conf
RUN sed -i '1 i\resolver local=on ipv6=off;' /etc/nginx/conf.d/crowdsec_openresty.conf
RUN SSL_CERTS_PATH=/etc/ssl/certs/ca-certificates.crt envsubst '$SSL_CERTS_PATH' < /tmp/crowdsec_openresty.conf > /etc/crowdsec/bouncers/crowdsec_openresty_lua.conf
RUN sed -i '1 i\resolver local=on ipv6=off;' /etc/crowdsec/bouncers/crowdsec_openresty_lua.conf
RUN sed -i '/^http {/,/^}/!b;/^}/i\\n include \/etc\/crowdsec\/bouncers\/crowdsec_openresty_lua.conf;' /usr/local/openresty/nginx/conf/nginx.conf
COPY ./docker/docker_start.sh /


ENTRYPOINT /bin/bash docker_start.sh