Tres Plummer
Tres Plummer

Reputation: 1

How do I run commands in the Vapor UI after deploying Laravel 8 App in Vapor using Docker runtime?

I have been using Laravel Vapor for several years now using native runtimes and have never had an issue until recently when needing to use the Imageick PHP extension. Native runtimes don't support PHP extensions so I decided to try using a docker runtime on a staging server and everything went smoothly until I tried to run the migrate command in the Vapor UI. Getting the following error in Vapor-UI:

sh: /opt/bin/php: not found

Have tried unsuccessfully searching for the location of php in the staging deployment as well as adding alias for php in my dockerfile. Here is my current staging.Dockerfile:

ARG VERSION=php81

FROM laravelphp/vapor:${VERSION}

RUN apk add imagemagick imagemagick-dev php81-pecl-imagick \
&& pecl install imagick \
&& docker-php-ext-enable imagick

COPY . /var/task

Has anyone run in to this issue before? Seems too simple but I have zero experience with Docker and after reading through some documentation I could understand why it wouldn't be available, but then during deployment on vapor I would have thought there would be issues... and if its not available is there any way to access php in the Vapor UI by adding something to the Dockerfile or elsewhere?

Upvotes: 0

Views: 400

Answers (1)

Tres Plummer
Tres Plummer

Reputation: 1

After some testing I was able to locate php and am using the following line to get access to php in Vapor UI:

RUN mkdir /opt/bin && cp /usr/local/bin/php /opt/bin/php

The entire Dockerfile for production:

ARG VERSION=php82-arm

FROM laravelphp/vapor:php82-arm

RUN apk add imagemagick imagemagick-dev php81-pecl-imagick \
&& pecl install imagick \
&& docker-php-ext-enable imagick

RUN mkdir /opt/bin && cp /usr/local/bin/php /opt/bin/php

COPY . /var/task

Upvotes: 0

Related Questions