grimoire icon indicating copy to clipboard operation
grimoire copied to clipboard

Reduce Image Size and add new Alpine based Image

Open TheGameProfi opened this issue 9 months ago • 1 comments

Description:

This PR refines the Dockerfile by splitting the build and release stages into separate images to reduce dependency noise. The build stage is now isolated, ensuring the release image is cleaner and more lightweight. Additionally, the node_modules directory is no longer copied, as the server has already been built, making that step unnecessary.

To further optimize the image size, a new Dockerfile is introduced based on Alpine. This version is a smaller image that uses Alpine-specific commands instead of Debian commands, ensuring reduced size without sacrificing functionality.

Result:

docker image ls | grep grimoire
thegameprofi/grimoire    alpine      88b2537f2420   15 minutes ago   95.4MB
thegameprofi/grimoire    latest      c9abcecaabb6   19 minutes ago   227MB
goniszewski/grimoire     latest      d7724382aafb   6 weeks ago      875MB

Changes:

  • Multi-stage Dockerfile: Split the process into separate images using FROM in different stages.
    • Build Stage: Contains dependencies and build steps.
    • Release Stage: Contains only the necessary release files, reducing the final image size.
  • Removed node_modules copy: Since the server is already built, there's no need to include node_modules.
  • Added Alpine-based Dockerfile: This image uses Alpine as the base, with equivalent Debian commands converted for compatibility.

TheGameProfi avatar Apr 11 '25 13:04 TheGameProfi

Please retry analysis of this Pull-Request directly on SonarQube Cloud

sonarqubecloud[bot] avatar May 20 '25 19:05 sonarqubecloud[bot]

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

sonarqubecloud[bot] avatar May 20 '25 19:05 sonarqubecloud[bot]

I tested it locally and both worked normally. 👍

TheGameProfi avatar May 20 '25 19:05 TheGameProfi