Kubernetes: Speedup your sites with this Docker image

Jun 4 · 2 min read

If you want to have 100/100 PWA, you have to make your Web Experience reliable, engaging and of course fast! Today we are going to accomplish the last one by making a very small change to your Dockerfile to bring massive speedup to your static website.

To do this, we are going to use optimized version of nginx built and used by Google, that is called “PageSpeed”.

According to their website:

PageSpeed improves web page latency by changing the resources on that web page to implement web performance best practices

So, what it really does is applying automatic optimisations to the website’s resources on the go, to make it load real fast. Here is a list of features it does out-of-box, without any additional configuration required:

  • Canonicalize JavaScript Libraries
  • Extend Cache
  • Combine, Inline, Outline, Prioritize, Rewrite, Flatten CSS
  • Inline Google Fonts API CSS
  • Combine, Inline, Minify, Defer JavaScript
  • Pre-Resolve DNS
  • Rewrite Domains and Style Attributes
  • Combine Heads
  • Optimize, Lazy Load, Resize, Deduplicate Images
  • Remove Quotes, Comments, Whitespaces
  • Trim URLs
  • Convert Meta Tags

And also much more, all without breaking your website 👍

Sounds good? Let’s make our Website optimised as well!

The Setup

So, let’s say we have this very common nginx Dockerfile to serve our site:

Now, we want to have the pagespeed version of nginx. Luckily there is a pre-built containerized version of it on Dockerhub.

Here is all we need to transform our existing nginx-powered site to the nginx-pagespeed-powered site 💪

Was pretty easy, right? Now we’ve got a fully optimised site, without us having to do something extraordinary 😄



Written by


Doing something nobody did before and solving problems, that are truly important, but had yet to be resolved

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade