EDM115 / unzip-bot

Telegram bot deployable to heroku that can extract every archive !
https://t.me/unzip_edm115bot
MIT License
91 stars 125 forks source link

[FEATURE REQUEST] Reduce the size of the Docker image #249

Open EDM115 opened 9 months ago

EDM115 commented 9 months ago

To reduce the size of your Docker layer for a Python bot that handles file extraction and uploading, without needing a graphical interface, you can focus on removing packages that are primarily used for GUI support, multimedia processing, or are not directly required by your application. Here's a breakdown of potential candidates for removal:

  1. Graphical and Desktop Environment Packages:

    • Packages related to graphical interfaces, such as gdk-pixbuf2, libx11, cairo, libxext, libxdmcp, libxau, libxcb, libxrender, libxcursor, libxft, and libxv.
    • Icon themes and cursor themes like hicolor-icon-theme and default-cursors.
    • Font-related packages: fontconfig, freetype2, libxft, pango.
  2. Multimedia Libraries:

    • Audio and video codecs and libraries that are not required for the bot's functionality, such as alsa-lib, libvorbis, mpg123, libtheora, libvpx, opus, speex, x264, x265, libogg, flac, jack2.
    • Advanced multimedia processing libraries like ffmpeg (if your bot does not process audio or video files).
  3. Other Libraries and Utilities:

    • Libraries supporting specific hardware or interfaces, like libdrm, mesa, libva, libvdpau, lm_sensors, libiec61883, libavc1394.
    • Libraries for image formats not used by your bot, e.g., libjpeg-turbo, libpng, libtiff, libwebp, librsvg, libjxl.
    • 3D rendering or GPU acceleration libraries, such as vulkan-icd-loader, libglvnd.
    • Any development tools or libraries not directly used, like gcc, binutils, make (keep these if they're necessary for building your bot).
  4. Optional Dependencies:

    • Examine optional dependencies of installed packages. If they are not essential for your bot's operation, consider removing them.
  5. Cleanup Steps:

    • After removing packages, clear the pacman cache with pacman -Scc.
    • Remove any temporary files and clean up unnecessary directories.
  6. Consider Using a Slimmer Base Image:

    • If you are not tightly coupled with Arch Linux, consider using a more lightweight base image like Alpine Linux, which is designed for a smaller footprint.
  7. Review Python Packages:

    • Ensure that only the necessary Python packages are installed. Use a virtual environment to manage Python dependencies.

Remember, before removing any package, make sure it is not a dependency for other packages that your application needs. Testing your application after each major change is essential to ensure its functionality remains intact.