1
1
ARG NGINX_VERSION="1.24.0"
2
- ARG NGINX_NAME="nginx-${NGINX_VERSION}"
3
2
4
3
FROM docker.io/library/debian:bullseye AS build
5
4
6
5
ARG NGINX_VERSION
7
- # https://hg.nginx.org/nginx
8
- ARG NGINX_BRANCH=default
9
- ARG NGINX_COMMIT=c38588d8376b
10
6
# https://github.com/google/ngx_brotli
11
7
ARG NGX_BROTLI_COMMIT=6e975bcb015f62e1f303054897783355e2a877dc
12
8
# https://nginx.org/en/docs/njs/changes.html
@@ -15,50 +11,50 @@ ARG NGX_CAR_RANGE_VERSION="v0.6.0"
15
11
16
12
# Install dependencies
17
13
RUN apt-get update && apt-get install -y \
18
- dpkg-dev \
19
- build-essential \
20
- mercurial \
21
- gnupg2 \
22
- git \
23
- gcc \
24
- cmake \
25
- libpcre3 libpcre3-dev \
26
- zlib1g zlib1g-dev \
27
- openssl \
28
- libssl-dev \
29
- curl \
30
- unzip \
31
- wget \
32
- libxslt-dev \
33
- llvm-dev \
34
- libclang-dev \
35
- clang \
36
- && rm -rf /var/lib/apt/lists/* \
37
- && curl https://sh.rustup.rs -sSf | bash -s -- -y \
38
- && curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v24.1/protoc-24.1-linux-x86_64.zip \
39
- && unzip protoc-24.1-linux-x86_64.zip -d /usr/local \
40
- && rm protoc-24.1-linux-x86_64.zip
14
+ dpkg-dev \
15
+ build-essential \
16
+ mercurial \
17
+ gnupg2 \
18
+ git \
19
+ gcc \
20
+ cmake \
21
+ libpcre3 libpcre3-dev \
22
+ zlib1g zlib1g-dev \
23
+ openssl \
24
+ libssl-dev \
25
+ curl \
26
+ unzip \
27
+ wget \
28
+ libxslt-dev \
29
+ llvm-dev \
30
+ libclang-dev \
31
+ clang \
32
+ && rm -rf /var/lib/apt/lists/* \
33
+ && curl https://sh.rustup.rs -sSf | bash -s -- -y \
34
+ && curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v24.1/protoc-24.1-linux-x86_64.zip \
35
+ && unzip protoc-24.1-linux-x86_64.zip -d /usr/local \
36
+ && rm protoc-24.1-linux-x86_64.zip
41
37
42
38
ENV PATH="/root/.cargo/bin:${PATH}"
43
39
44
40
WORKDIR /usr/src
45
41
46
42
RUN echo "Cloning brotli $NGX_BROTLI_COMMIT" \
47
- && mkdir /usr/src/ngx_brotli \
48
- && cd /usr/src/ngx_brotli \
49
- && git init \
50
- && git remote add origin https://github.com/google/ngx_brotli.git \
51
- && git fetch --depth 1 origin $NGX_BROTLI_COMMIT \
52
- && git checkout --recurse-submodules -q FETCH_HEAD \
53
- && git submodule update --init --depth 1
43
+ && mkdir /usr/src/ngx_brotli \
44
+ && cd /usr/src/ngx_brotli \
45
+ && git init \
46
+ && git remote add origin https://github.com/google/ngx_brotli.git \
47
+ && git fetch --depth 1 origin $NGX_BROTLI_COMMIT \
48
+ && git checkout --recurse-submodules -q FETCH_HEAD \
49
+ && git submodule update --init --depth 1
54
50
55
51
RUN echo "Cloning njs $NJS_VERSION" \
56
- && mkdir /usr/src/njs \
57
- && cd /usr/src \
58
- && hg clone --rev $NJS_VERSION http://hg.nginx.org/njs /usr/src/njs \
59
- && cd /usr/src/njs \
60
- && ./configure \
61
- && make
52
+ && mkdir /usr/src/njs \
53
+ && cd /usr/src \
54
+ && hg clone --rev $NJS_VERSION http://hg.nginx.org/njs /usr/src/njs \
55
+ && cd /usr/src/njs \
56
+ && ./configure \
57
+ && make
62
58
63
59
ARG CONFIG="--prefix=/etc/nginx \
64
60
--sbin-path=/usr/sbin/nginx \
@@ -94,18 +90,18 @@ ARG CONFIG="--prefix=/etc/nginx \
94
90
--add-dynamic-module=/usr/src/ngx_brotli \
95
91
--add-dynamic-module=/usr/src/njs/nginx"
96
92
97
- RUN echo "Cloning nginx and building $NGINX_VERSION (rev $NGINX_COMMIT from '$NGINX_BRANCH' branch)" \
98
- && hg clone https://hg.nginx.org/nginx /usr/src/nginx-$NGINX_VERSION \
99
- && cd /usr/src/nginx-$NGINX_VERSION \
100
- && hg up release-$NGINX_VERSION \
101
- && ./auto/configure $CONFIG \
102
- && make \
103
- && make install
93
+ RUN echo "Downloading and extracting nginx $NGINX_VERSION" \
94
+ && mkdir /usr/src/nginx \
95
+ && curl -fsSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | tar -zx --strip-components=1 -C /usr/src/nginx
104
96
105
- ENV NGINX_DIR=/usr/src/nginx-$NGINX_VERSION
97
+ RUN echo "Configuring, building, and installing nginx $NGINX_VERSION" \
98
+ && cd nginx \
99
+ && ./configure $CONFIG \
100
+ && make \
101
+ && make install
106
102
107
- RUN echo "Cloning car_range $NGX_CAR_RANGE_VERSION, nginx dir: $NGINX_DIR " \
108
- && mv $NGINX_DIR/ src/http/v2/* $NGINX_DIR /src/http/ \
103
+ RUN echo "Cloning car_range $NGX_CAR_RANGE_VERSION" \
104
+ && mv /usr/ src/nginx/src/ http/v2/* /usr/src/nginx /src/http/ \
109
105
&& git clone -b $NGX_CAR_RANGE_VERSION --depth 1 https://github.com/filecoin-saturn/nginx-car-range.git /usr/src/ngx_car_range \
110
106
&& cd /usr/src/ngx_car_range \
111
107
&& cargo build --release -v --config net.git-fetch-with-cli=true
@@ -114,26 +110,24 @@ FROM docker.io/library/nginx:${NGINX_VERSION}
114
110
115
111
SHELL ["/bin/bash" , "-c" ]
116
112
117
- ARG NGINX_NAME
118
-
119
113
COPY --from=build /usr/sbin/nginx /usr/sbin/
120
- COPY --from=build /usr/src/${NGINX_NAME} /objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules/
121
- COPY --from=build /usr/src/${NGINX_NAME} /objs/ngx_http_brotli_static_module.so /usr/lib/nginx/modules/
122
- COPY --from=build /usr/src/${NGINX_NAME} /objs/ngx_http_js_module.so /usr/lib/nginx/modules/
114
+ COPY --from=build /usr/src/nginx /objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules/
115
+ COPY --from=build /usr/src/nginx /objs/ngx_http_brotli_static_module.so /usr/lib/nginx/modules/
116
+ COPY --from=build /usr/src/nginx /objs/ngx_http_js_module.so /usr/lib/nginx/modules/
123
117
COPY --from=build /usr/src/ngx_car_range/target/release/libnginx_car_range.so /usr/lib/nginx/modules/ngx_http_car_range_module.so
124
118
125
119
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
126
- && curl -fsSL https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash - \
127
- && apt-get install --no-install-recommends -y \
128
- nodejs \
129
- speedtest \
130
- logrotate \
131
- jq \
132
- && rm -rf /var/lib/apt/lists/*
120
+ && curl -fsSL https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash - \
121
+ && apt-get install --no-install-recommends -y \
122
+ nodejs \
123
+ speedtest \
124
+ logrotate \
125
+ jq \
126
+ && rm -rf /var/lib/apt/lists/*
133
127
134
128
# Download lassie
135
129
ARG TARGETPLATFORM
136
- ARG LASSIE_VERSION="v0.15.0 "
130
+ ARG LASSIE_VERSION="v0.16.1 "
137
131
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=amd64; \
138
132
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=arm64; \
139
133
else ARCHITECTURE=386; fi \
@@ -156,7 +150,8 @@ COPY container/logrotate/* /etc/logrotate.d/
156
150
COPY container/cron/* /etc/cron.d/
157
151
158
152
# Load CIDs ban lists
159
- RUN rm /etc/nginx/conf.d/default.conf && curl -s https://badbits.dwebops.pub/denylist.json | jq 'map({(.anchor): true}) | add' > /etc/nginx/denylist.json
153
+ RUN rm /etc/nginx/conf.d/default.conf \
154
+ && curl -s https://badbits.dwebops.pub/denylist.json | jq 'map({(.anchor): true}) | add' > /etc/nginx/denylist.json
160
155
161
156
# Add logrotate cronjob
162
157
RUN chmod 0644 /etc/cron.d/* && { crontab -l; cat /etc/cron.d/logrotate; } | crontab -
0 commit comments