-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathDockerfile
106 lines (89 loc) · 2.75 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#############
# Nginx Builder
#############
FROM debian:bookworm-slim AS nginxbuilder
ARG OPENRESTY_VERSION
ARG LUA_VERSION
ARG LUAROCKS_VERSION
RUN apt-get update \
&& apt-get install -y \
build-essential \
ca-certificates \
libncurses-dev \
libpcre3-dev \
libreadline-dev \
libssl-dev \
openssl unzip \
wget \
zlib1g-dev \
git \
libmaxminddb-dev
# Lua build
COPY ./scripts/build-lua /tmp/build-lua
RUN /tmp/build-lua
# Nginx build
COPY ./scripts/build-openresty /tmp/build-openresty
RUN /tmp/build-openresty
#############
# Final Image
#############
FROM debian:bookworm-slim AS final
LABEL maintainer="Jamie Curnow <[email protected]>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG TARGETPLATFORM
RUN echo "Base: debian:bookworm-slim, ${TARGETPLATFORM:-linux/amd64}" > /built-for-arch
# OpenResty uses LuaJIT which has a dependency on GCC
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apache2-utils \
ca-certificates \
curl \
figlet \
jq \
libncurses6 \
libpcre3 \
libreadline8 \
openssl \
perl \
tzdata \
unzip \
zlib1g \
gettext \
wget \
xz-utils \
libmaxminddb-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
COPY ./files/.bashrc /root/.bashrc
# Copy lua and luarocks builds from first image
COPY --from=nginxbuilder /tmp/lua /tmp/lua
COPY --from=nginxbuilder /tmp/luarocks /tmp/luarocks
COPY ./scripts/install-lua /tmp/install-lua
# Copy openresty build from first image
COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
COPY ./scripts/install-openresty /tmp/install-openresty
# Copy crowdsec openresty bouncer install script
COPY ./scripts/install-crowdsec_openresty_bouncer /tmp/install-crowdsec_openresty_bouncer
ARG OPENRESTY_VERSION
ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
OPENRESTY_VERSION=${OPENRESTY_VERSION} \
CROWDSEC_OPENRESTY_BOUNCER_VERSION=${CROWDSEC_OPENRESTY_BOUNCER_VERSION}
# Install openresty, lua, then clean up file system
RUN apt-get update \
&& apt-get install -y gcc make socat git \
&& /tmp/install-lua \
&& /tmp/install-openresty \
&& apt-get remove -y make gcc git wget gettext \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.license="MIT" \
org.label-schema.name="nginx-full" \
org.label-schema.description="A base image for use by Nginx Proxy Manager" \
org.label-schema.url="https://github.com/nginxproxymanager/docker-nginx-full" \
org.label-schema.vcs-url="https://github.com/nginxproxymanager/docker-nginx-full.git" \
org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:latest"