Skip to content

Commit 18703ec

Browse files
authored
Update dockerfile for local dev (#76)
1 parent d1d62f5 commit 18703ec

2 files changed

Lines changed: 19 additions & 37 deletions

File tree

Dockerfile

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
ARG BUILD_ENV=git
2-
FROM docker.io/openresty/openresty:alpine-fat as with_deps
2+
3+
FROM docker.io/openresty/openresty:alpine-fat AS with_deps
34
RUN luarocks install lua-resty-http 0.17.1-0
45

5-
FROM with_deps as git
6-
ARG BUILD_ENV=git
6+
FROM with_deps AS git
77
ARG LUA_LIB_VERSION=v1.0.11
8-
RUN if [ "$BUILD_ENV" == "git" ]; then apk add --no-cache git; fi
9-
RUN if [ "$BUILD_ENV" == "git" ]; then git clone -b "${LUA_LIB_VERSION}" https://github.com/crowdsecurity/lua-cs-bouncer.git ; fi
8+
RUN apk add --no-cache git
9+
RUN git clone -b "${LUA_LIB_VERSION}" https://github.com/crowdsecurity/lua-cs-bouncer.git /lua-cs-bouncer
1010

11-
FROM with_deps as local
12-
RUN if [ "$BUILD_ENV" == "local" ]; then COPY ./lua-cs-bouncer/ lua-cs-bouncer; fi
11+
FROM with_deps AS local
12+
COPY lua-cs-bouncer/ /lua-cs-bouncer/
13+
14+
FROM ${BUILD_ENV} AS final
15+
# (optional, if you want to use it in RUN steps)
16+
ARG BUILD_ENV
1317

14-
FROM ${BUILD_ENV}
1518
RUN mkdir -p /etc/crowdsec/bouncers/ /var/lib/crowdsec/lua/templates/
16-
RUN cp -R lua-cs-bouncer/lib/* /usr/local/openresty/lualib/
17-
RUN cp -R lua-cs-bouncer/templates/* /var/lib/crowdsec/lua/templates/
18-
RUN cp lua-cs-bouncer/config_example.conf /etc/crowdsec/bouncers/crowdsec-openresty-bouncer.conf
19-
RUN rm -rf ./lua-cs-bouncer/
20-
COPY ./openresty /tmp
19+
RUN cp -R /lua-cs-bouncer/lib/* /usr/local/openresty/lualib/
20+
RUN cp -R /lua-cs-bouncer/templates/* /var/lib/crowdsec/lua/templates/
21+
RUN cp /lua-cs-bouncer/config_example.conf /etc/crowdsec/bouncers/crowdsec-openresty-bouncer.conf
22+
RUN rm -rf /lua-cs-bouncer
23+
24+
COPY openresty /tmp
2125
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
2226
RUN sed -i '1 i\resolver local=on ipv6=off;' /etc/nginx/conf.d/crowdsec_openresty.conf
23-
COPY ./docker/docker_start.sh /
27+
COPY docker/docker_start.sh /
2428

25-
ENTRYPOINT ["/bin/sh", "docker_start.sh"]
29+
ENTRYPOINT ["/bin/sh", "docker_start.sh"]

Dockerfile.lua-bouncer-plugin

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)