Docker-nginx: Brotli support for nginx alpine image

Created on 10 Oct 2019  Â·  24Comments  Â·  Source: nginxinc/docker-nginx

Would be good to have official nginx alpine docker image with brotli support with fall back to gzip.

Previously I found #210 issue with closed #216 PR. That PR closed due to issue where google/ngx_brotli want to drop support in 2017, but today looks like google/ngx_brotli now live! Previous fork eustas/ngx_brotli merged back to original repo.

Today all major browsers support brotli and that algorithm very efficient.
Would be good to have brotli + nginx alpine docker image

Most helpful comment

A nice solution would be to create an official ONBUILD image that would allow developers to specify any additional modules which are not "officially" supported by the team, this way the responsibility of maintaining these modules wouldn't fall on the team itself, while developers would have a fairly straightforward way to build additional modules on top of the upstream image. Though I'm not really sure how simple it is to implement such an image.

All 24 comments

The point about not shipping third-party modules still stands though.

@thresheek do we have right now any reason not to add Brotli support to nginx official modules? If there is some legal reason, could we make the exception of using a third-party module here? If there are no good reasons, how we can help in adding Brotli support to nginx?

Brotli looks like a great feature for performance, but right now there is no good Docker image with nginx and Brotli.

The only way to add brotli to this image is to make it a part of an official nginx distribution. I see no way we can support that otherwise.

@thresheek of course. I think that nginx should support Brotli by default.

What we can do to add official Brotli support? I saw batch in nginx tracker. Maybe there is a way to vote or pay to promote some feature?

I would say sending a patch to the development mailing list would at least make sure developers could comment on it; however I see it was submitted in early 2017 with no real reply, which is frustrating.

A viable option would be also to implement a "development image" as discussed in https://github.com/nginxinc/docker-nginx/issues/239 - it wouldnt have the effect of an image that will have all the modules built-in, but would it make easier for everyone to do their own images/build the modules they need.

@thresheek in 2017 nginx devs not accept it due to same reason, because google/ngx_brotli stop their development.

because google/ngx_brotli stop their development.

Now it is not a problem, since Google continue development

We need to find some idea how to create official nginx image with brotli support.

It's looks like few additional strings in dockerfile, can provide huge positive impact on community.

Also de-facto best in class nginx web server just in win-win situation if support will be provided.

You can add brotli support with your own alpine image easily enough afaik. Drawback is that you don't build from source, using the version of Alpines nginx package(current alpine:3.10 provides nginx 1.16.x).

I have not tried it yet, but they have quite a few modules are available as separate packages, you just install them with the nginx package and should have support. I've done similar with PHP.

I'm not entirely sure how that works if you're meant to compile them in like I've seen official nginx and PHP images do(building from source instead). But presumably if someone submitted a nginx-mod-brotli package and that got accepted, we'd have an easy way to use brotli module. AFAIK, right now we have to maintain a fork of this repos dockerfile?

Looks like they're included as dynamically linked modules to make them optional. Is that something that could be done here too?

A nice solution would be to create an official ONBUILD image that would allow developers to specify any additional modules which are not "officially" supported by the team, this way the responsibility of maintaining these modules wouldn't fall on the team itself, while developers would have a fairly straightforward way to build additional modules on top of the upstream image. Though I'm not really sure how simple it is to implement such an image.

Any news?

Nobody volunteered a solution so far.

As per ONBUILD, using those is discouraged: https://github.com/docker-library/official-images/issues/2076

Another possible solution, would be to add a brotli_static similar to gzip_static, so at least pre-compressed files could be served.

What are the alternatives to have brotli if it won't be included in the base image ?

If moving out of nginx is okay, caddy is a good alternative.

On Thu, Aug 20, 2020, 14:10 Ahmed El Moden notifications@github.com wrote:

What are the alternatives to have brotli if it won't be included in the
base image ?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/nginxinc/docker-nginx/issues/371#issuecomment-677462095,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACSLJZPKXCFS53GHC3SOH33SBTOODANCNFSM4I7MJ7IQ
.

@Herz3h The docker image fholzer/nginx-brotli has nginx with brotli support.

@Macil @Herz3h I've been using xddxdd/nginx myself... But had to make a couple config mods for my own needs. As I'm precompressing the files I need compressed so don't need dynamic compression at all.

Still not on roadmap? brotli is already standard for web(text) compression...

Sorry for the mean words, I removed them.

Edit: I found a way to minimally extend the official image with ngx_brotli support, see here: https://github.com/Korijn/docker-nginx-brotli

Would be nice to get Brotli support upstream.

This is a must have feature.

I think there's a drop-in nginx brotli module coming to alpine soon.
https://pkgs.alpinelinux.org/package/edge/main/x86/nginx-mod-http-brotli
Its been available since nginx-1.18.0-r5, so it may arrive with alpine v3.13

Hi. I've added a way to make it easier to add modules on top of the official image, please check https://github.com/nginxinc/docker-nginx/tree/master/modules for more information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hasancansaral picture hasancansaral  Â·  6Comments

HeyRobb picture HeyRobb  Â·  5Comments

colinmollenhour picture colinmollenhour  Â·  6Comments

czka picture czka  Â·  4Comments

rokf picture rokf  Â·  5Comments