fedora-copr / log-detective-website

Data collection page for Log Detective AI
11 stars 8 forks source link

Make the production docker image smaller #9

Closed FrostyX closed 8 months ago

FrostyX commented 11 months ago

It is over 1GB now because it for example contains a lot of Java stuff which are needed only for the compilation but not needed for runtime.

FrostyX commented 9 months ago

We can clean a lot of space by

# Remove all build dependencies to have a smaller production image
RUN dnf -y erase java
RUN dnf -y clean all
RUN rm -rf /src/frontend/node_modules/

but this won't help us when pushing because even though the total disk usage showed by ncdu / is much smaller, the docker image isn't because of the intermediate layers.

TomasTomecek commented 9 months ago

We could use multi stage builds: https://docs.docker.com/build/building/multi-stage/

I'll try to look into this tomorrow on Friday, sounds like a solid friday work :))

FrostyX commented 9 months ago

This is not a release blocker for us but if you find it interesting, then sure, sounds good :-)