KEINOS / Dockerfile_of_PHP8-JIT

✅ Dockerfile of PHP8.0 with JIT Enabled in Alpine Image.
https://arkadiuszkondas.com/how-to-run-php-8-with-jit-support-using-docker/
9 stars 4 forks source link

Slimmer/smaller image size #16

Closed KEINOS closed 3 years ago

KEINOS commented 4 years ago

As of build_20200825, the size of our image for AMD64 is 40.66 MB, and the official image for AMD64 is 28.13 MB.

This 12.53 MB of difference might be causing the archive inside the image.

Both images include the PHP source archive under /usr/src/ but the archive size differs around 10 MB.

$ # Our Image
$ docker run --rm keinos/php8-jit:build_20200825 ls -lah /usr/src
total 23M    
drwxr-xr-x    2 root     root        4.0K Aug 25 14:45 .
drwxr-xr-x    1 root     root        4.0K Aug 25 14:56 ..
-rw-r--r--    1 root     root       22.5M Aug 25 14:45 php.zip

$ # Official Image
$ docker run --rm php:8.0.0beta2-alpine ls -lah /usr/src
total 10M    
drwxr-xr-x    1 root     root        4.0K Aug 21 22:00 .
drwxr-xr-x    1 root     root        4.0K Aug 21 22:00 ..
-rw-r--r--    1 root     root       10.1M Aug 21 21:53 php.tar.xz
-rw-r--r--    1 root     root         858 Aug 21 21:53 php.tar.xz.asc

So, we might lighten the size if we switch the archive from ZIP to tar.xz.

KEINOS commented 4 years ago

As of build_20200907, we reduced almost 10 MB of its size by re-archiving it with 7zip !

Now it's 30.64 MB which is only +2.32 MB from the official 8.0.0 beta3 alpine AMD64 image of 28.32 MB.

KEINOS commented 4 years ago

Remove the PHP source archive from the image

IT IS IMPORTANT to keep the PHP source archive which was used to compile the PHP in the image. But once the container is up, it is not as important as the image build stage.

So, why don't we push the PHP source archive to the GitHub's packages so that we can create a script that downloads the archive when it's needed?

KEINOS commented 4 years ago

GitHub Packages works only for packages such as docker image, npm, etc. It is not intended to provide archives. So our option would be:

  1. Attach the PHP source archive in the release note's assets.
  2. Use the official beta release
KEINOS commented 3 years ago

I think now it's small enough for this issue. Closing.