aschmelyun / docker-compose-laravel

A docker-compose workflow for local Laravel development
https://youtube.com/user/aschmelyun
MIT License
2.59k stars 1.17k forks source link

PHP Zip plugin #206

Open Boy19991 opened 1 year ago

Boy19991 commented 1 year ago

In the php dockerfile, it seems it doesnt install any zip package. If you try to install laravel inside the container after docker-compose up, it says something like "not zip package aborting" - at this point I found

RUN apt-get update \
     && apt-get install -y libzip-dev \
     && docker-php-ext-install zip

however, this still causes the following warning

As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.

In search of the ultimate dockerfile. Also, sorry if this is the wrong place to ask this. Jolly Boy.

codespearhead commented 1 year ago

In the php dockerfile, it seems it doesnt install any zip package. If you try to install laravel inside the container after docker-compose up, it says something like "not zip package aborting" - at this point I found

RUN apt-get update \
     && apt-get install -y libzip-dev \
     && docker-php-ext-install zip

however, this still causes the following warning

As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.

In search of the ultimate dockerfile. Also, sorry if this is the wrong place to ask this. Jolly Boy.

I might be misinterpreting your question, but there's no point in using containerized applications, or even this project at all, if you're going to install Laravel onto the container yourself.

As a matter of fact, the container image used in the Docker files of the project don't even have APT in it since the base image is based on Alpine Linux. The Usage section of the readme file of this repository says how you should go about that instead.

As for your question per se, I just checked the container image in question, php:8-fpm-alpine, and I can confirm that it doesn't seem to come with unzip, or at least not with a full-fledged version of it.

> docker run -it --rm --name test php:8-fpm-alpine sh
> unzip -v
# BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary. [...]
> apk add unzip
> unzip -v
# UnZip 6.00 of 20 April 2009, by Info-ZIP [...]

So try adding RUN apk add unzip on the second line of php.dockerfile (or in the other dockerfiles) and tell us if that solves the problem.

More about that Docker one-liner.

Boy19991 commented 1 year ago

@Paguiar735 Thank you for your detailed reply. I ended up solving my issue by just hacking at it until it worked.

Regarding your comment

I might be misinterpreting your question, but there's no point in using containerized applications, or even this project at all, if you're going to install Laravel onto the container yourself

Then where do you install it? php.dockerfile installs laravel to WORKDIR /var/www/html right? Isnt that on the container?

In my project I used composer create-project laravel on a volume

volumes:
      - ./:/var/www/html

Can you explain this point for me? If my question is retarded you can just delete this thread :)

JollyBoy.

codespearhead commented 1 year ago

@Paguiar735 Thank you for your detailed reply. I ended up solving my issue by just hacking at it until it worked.

Regarding your comment

I might be misinterpreting your question, but there's no point in using containerized applications, or even this project at all, if you're going to install Laravel onto the container yourself

Then where do you install it? php.dockerfile installs laravel to WORKDIR /var/www/html right? Isnt that on the container?

In my project I used composer create-project laravel on a volume

volumes:
      - ./:/var/www/html

Can you explain this point for me? If my question is retarded you can just delete this thread :)

JollyBoy.

I'm afraid I can't provide further assistance because I don't have any experience with the PHP ecosystem, just with containerization for the sake of the question.

If anyone here is enough well-versed with Laravel and need confirmation about the container dynamics around the project to help with this issue, feel free to ping me.