-
Notifications
You must be signed in to change notification settings - Fork 215
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
Nginx docker alpine image #89
Comments
@WangHansen this is probably what you're looking for |
@dptole Thanks for the response, I saw it early, but this one starts from the Alpine image instead of the Nginx alpine which is not really compatible with what I wanted. |
@WangHansen oh, so we are basically trying to do the same thing from different places lol. I already have a running container and wanted to install the module on it. Sorry I couldn't help :/ |
@WangHansen well, the only solutions I find gives essentially the same instructions as the Dockerfile I sent you: Install the brotli module together with the binaries for nginx
I'm gonna give up. Good luck for you, I'll keep subscribed for updates on this issue |
@dptole I really appreciate the help, this is awesome, thanks again! |
Hi. Not sure about Alpine, here is how I tested brotli module in Busty Nginx Docker image: docker run -it -p 8443:8443 -v `pwd`:/home/ngx_brotli nginx:perl /bin/bash
# Now we are inside container.
apt-get update
apt-get install gcc git libpcre3-dev libssl-dev make zlib1g-dev -y
cd /home
git clone https://github.com/google/ngx_brotli.git --recurse-submodules
git clone https://github.com/nginx/nginx.git
cd /home/nginx
git checkout release-1.17.8
./auto/configure \
--add-dynamic-module=/home/ngx_brotli \
--with-debug \
--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.17.8/debian/debuild-base/nginx-1.17.8=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
make modules
# Never used Docker as it was meant to. Basically, you need to export this file and
# add it to clean docker container.
cp objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules/ In a Docker container with a module library you just have to add a line to conf file: |
@eustas thanks a lot for your message! Here is working Dockerfile based on it: # Build
FROM nginx:1.19.6 as build
WORKDIR /build
# install brotli build dependencies
RUN \
apt-get update > /dev/null \
&& apt-get install gcc git libpcre3-dev libssl-dev make zlib1g-dev -y
# build brotli
RUN git clone https://github.com/google/ngx_brotli.git --recurse-submodules
RUN git clone https://github.com/nginx/nginx.git
WORKDIR /build/nginx
RUN git checkout release-1.19.6
RUN ./auto/configure \
--add-dynamic-module=/build/ngx_brotli \
--with-debug \
--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.19.6/debian/debuild-base/nginx-1.19.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
RUN make modules
# Run
FROM nginx:1.19.6
# add compiled brotli module
COPY --from=build /build/nginx/objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules/
COPY --from=build /build/nginx/objs/ngx_http_brotli_static_module.so /usr/lib/nginx/modules/
# run nginx with configuration reload once in every 6 hours
CMD /bin/sh -c 'while :; do /bin/sleep 6h & wait ${!}; /usr/sbin/nginx -s reload; done & /usr/sbin/nginx -g "daemon off;"' |
I put something very similar together and published it on docker hub. It is built as recommended on the official docker-nginx repo. It is also auto-updating daily without any human input required. You can find it here if that might be helpful: https://hub.docker.com/r/georgjung/nginx-brotli |
Hi, thanks for all the hard work, I was wondering what is the proper way to include this module within official the Nginx:apline image. I searched online but couldn't find anything, mostly just talk about how to use it on a local linux system. An official example would be really appreciated!
Here is my Dockerfile:
The text was updated successfully, but these errors were encountered: