Create Dockerfile for Zend Expressive

Asked

Viewed 199 times

1

Hello folks I’m having a hard time running the expressive zend with the Docker. I have other projects that work perfectly with Docker but when I try to develop with zend expressive, I can’t, it makes a mistake saying that you can’t find the vendor/autoload.php file, and it’s there.. I have tried several ways but there is no way, if I enter by MAMP, it works well, but by Ocker not. Does anyone know what it can be? Down goes the Dockerfile

FROM php:7.0-apache

RUN apt-get update

RUN a2enmod rewrite

RUN docker-php-ext-install pdo pdo_mysql

# install GD
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd

# install json
RUN docker-php-ext-install json

Ah, for me to create the php image I’m using "Docker build -t project/php7 . "

If anyone can help me, I’d appreciate it..

  • You entered the running container to check the file in its absolute path and its permissions?

  • What do you mean? I don’t understand.. what I know is that it has the correct permissions and that it is pointing to the public folder of the project, this is right even because it is giving the error of autoload.php, which is this: Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 11 Fatal error: require(): Failed Opening required 'vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/html/index.php on line 11

  • How do you know that the file is accessible inside the container? You’d have to get into it to be sure, you know? You have to run it in Detached (-d) mode and then log in to access your content with exec -it.

  • How do you know that the file is accessible inside the container? You’d have to get into it to be sure, you know? You have to run it in Detached (-d) mode and then log in to access your content with exec -it.

  • Ta.. I access the container and have to access the folder where it is? how can I do this? NOTE: I know how to access the bash, but I don’t know how to access the file

  • As you are complaining about the /var/www/html/index.php file, after entering the container, you run an "ls -l /var/www/html/index.php".

  • Look, I think I figured out what’s going on, I just don’t know how to fix it.. Zend Expressive has a folder structure like this: -config -src -public -vendor - templates , and I set up Docker-Compose.yml to access the public folder by default and because of that the vendor folder and the others are not being "assisted" by container. only that if I start the container at the root and access localhost/public, the route error in zend expressive. Do you know how to help me? if I didn’t explain it right let me know..

  • How is your Docker-Compose? How have you set up this public directory? Is there no way to inform all directories that need to be accessed in it? If you set as volumes, you would have to inform everyone.

  • You can have a look at my github at [https://github.com/AlexandroZaleski/zend-expressive] there you will see the whole structure and the Docker files.. a colleague of mine told me that I needed to install Composer in the container, I’m trying but I still can’t.. and I don’t know if it will solve.. but I’m shooting everywhere kkk. thanks for the force

  • Guys, I was able to make it work but using the internal php server with this line in my Docker-Compose: command: php -S 0.0.0.0:8080 -t public. By apache I still can’t, so I’m wearing it for now.. Thank you all

Show 5 more comments

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.