I try to work out a way to create a dev environment using docker and laravel.
I have the following dockerfile:
FROM php:7.1.3-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
&& chmod -R o+rw laravel-master/bootstrap laravel-master/storage
Laravel requires composer to call composer dump-autoload when working with database migration. Therefore, I need composer inside the docker container.
I tried:
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer
But when I call
docker-compose up
docker-compose exec app composer dump-autoload
It throws the following error:
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"composer\\\": executable file not found in $PATH\"\n"
I would be more than happy for advice how I can add composer to the PATH within my dockerfile or what else I can do to surpass this error.
Thanks for your support. Also: this is the gitub repository if you need to see the docker-compose.yml file or anything else.
.phar
checked in as part of the repository. – Namoshek