Autorun composer install #95
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ric/nginx-php-fpm#95
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Doesn't it make sense to run composer install on start if a composer.lock is found?
would this need to be run if the site was updated also?
Yes!
On Jan 3, 2017 10:03, "Ric Harvey" notifications@github.com wrote:
Ok where would the composer file live? Would you always include in the root? Also would it be the lock file we look for or a json file?
A lock file definitely and I think it must be in the root (not sure)
On Jan 3, 2017 10:32 AM, "Ric Harvey" notifications@github.com wrote:
@SamMousa are you sure about the lock file i thought that was auto created when you ran composer:
https://daylerees.com/the-composer-lock-file/
I may be wrong here so any help greatly appreciated. From reading that on a git pull I'd run composer install if there was a composer.json file in the root directory.
Yes it is created and contains the exact commit hash of each dependency.
For non libraries it is committed to version control (to guarantee a test
environment exactly the same as the production environment).
See
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
On Jan 3, 2017 18:37, "Ric Harvey" notifications@github.com wrote:
We'll spin up a new branch asap with this in to test.
Hi @SamMousa I've committed some code that "should" run install when you first launch the container and if you do a pull to update the code it should run an update.
Can you check this functionality behaves as expected.
Cheers Ric
Will do next week.
On Jan 6, 2017 3:56 PM, "Ric Harvey" notifications@github.com wrote:
@richarvey Just had a chance to look at the implementation and it doesn't work for my case.
The convention is to put
composer.lockis in the project root, not in the webroot. My project(s) use apublicfolder as the webroot, the code you've added searches for composer.lock in this webroot directory; instead it should be searched for in the project root. I'll add some comments to the commit as well.Also note, that there is technically no need to check for the existence of a composer lock file; if you just ru composer install you'll get this in case it can't run:
Right I think i understand now. Let me add some variables and see if we can get this working.
@richarvey Also add
--no-dev, since dev dependencies shouldn't be installed on production environment (alternatively use a variable for this)I don't think this is working is intended. The startup script checks for a
composer.lockfile in the webroot and executes the composer in the project root then.If webroot is not the same as project root, either the check for the
composer.lockfile does not work (becausecomposer.lockis located in the project root) or the composer command does not find thecomposer.lockfile (because the command is executed in the project root and thecomposer.lockis located in the webroot).Also, the
composer.pharbinary needs to reside in the repository (in the project root). I don't think that it is good practice to put this binary artifact into the source repository. The image itself should come with a composer binary.I'm happy to help with this issue, if you want. :)
@SKoschnicke I think the run command is just wrong. Composer is already included in the image.
https://github.com/ngineered/nginx-php-fpm/blob/master/Dockerfile#L177
I see. Good to know! The other problems are still valid, though.
@SKoschnicke sorry for the slow reply. I'd love some help with this. I've just merged in a better way to install composer but could you help with fixing the other issues please?
I'm currently ill but I think I can look into it on monday!
In case nobody noticed: I fixed the issue in #130
@SKoschnicke Apologies been really busy will get this done asap
Hi Guys, I'm not really sure why this still happening to me. Is there an option to disable the autorun of composer install?