hi, I have been playing around with Docker a little bit and decided to make a container for doxygen.
There already exist an image here: docker-doxygen/Dockerfile at master · hrektts/docker-doxygen · GitHub
FROM ubuntu:20.04
MAINTAINER mps299792458@gmail.com
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
doxygen graphviz git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /data
VOLUME ["/data"]
I’ve read that docker images are large and trying to keep them small is a WOT. OTOH multistage builds are there to optimize Dockerfiles. I think the image is ~150MB.
As you can see it uses the Ubuntu container and apt-get. It also has graphviz. Instead, i want to use the binary packages for Linux x86-64. Instead of Ubuntu i was using alpine at first which created an 50MB image. Then i created a parent container and went down to 35MB.
FROM alpine AS builder
ARG version
ENV version=${version}
RUN wget "https://sourceforge.net/projects/doxygen/files/rel-${version}/doxygen-${version}.linux.bin.tar.gz/download" \
&& tar -xvzf download
RUN mv /doxygen-${version} /doxygen
FROM scratch
WORKDIR /data
COPY --from=builder /doxygen/bin/doxygen /usr/bin/
However, there is an image from Docker Hub with only 23MB. How can i create a smaller image? (I don’t use the exact same source from doxygen so sizes are different).