The problem I ran into is that the libtidy that ext-tidy compiles against on recent
(3.7+) Alpine distributions is 5.6.0, while Debian-based distributions use libtidy 5.2.0.
When applications using ext-tidy run against libtidy 5.6.0, they produce content that
libxml2 cannot deal with (e.g., when using DOMDocument::loadXML()
), whereas the earlier
versions work fine.
As such, I needed to find a way to:
- Install libtidy 5.2.0
- Compile ext-tidy against it
I'm a Docker n00b, but @andrewscaya I found that if you can combine those last two
RUN
commands into a single command, you can reduce the image size by roughly188MB
or so (as long as you're continually ensuringgcc
and various compilers are not maintained on your images).The technique is to ensure you also delete all the newly installed dependencies in the same layer, saving on the final image build. In my case, I am using Alpine in the first place to help reduce my build overall, so I only keep the compile tools temporarily within the build layer itself. With the help of your code above and then adding one extra line at the bottom, I was able to slash my built image down from
371MB
down to183MB
(so, great reduction):Note the extra line at the bottom:
apk del --no-cache gcc g++ make cmake git
.