Giter Club home page Giter Club logo

Comments (3)

cedricziel avatar cedricziel commented on August 14, 2024

Thx for the ping - IMHO that's a two sided sword, but would make for better layer caching.

My thoughts are the following:

PRO (keep the vednor dir from the build host):

  • caching. A warmed vendor directory is nice for build times

CONTRA ():

  • users could have libraries in the vendor directory that do not belong to the current platform in cases the outer environment isnt congruent to the inner environment (the container one). That would cache garbage that would be frozen in the layer through the COPY directive
  • what about manually changed files in the vendor directory? Composer checks the integrity on install, but afaik only if the vendor directory is empty or nonexistent

My proposal is actually something in the middle:
ONBUILD COPY composer.json and composer.lock (https://github.com/heroku/docker-php/blob/master/Dockerfile#L71) then composer install --no-scripts to populate the global composer cache in the image. That way, there's a nice caching layer in place until either one of those files change. Now we can keep removing the vendor directory as the packages will be resolved through the global cache.

from php-docker.

tmatsuo avatar tmatsuo commented on August 14, 2024

@cedricziel

Re: platform deps
We're running composer install and it should fix it.

Re: manually changed files in the vendor directory?
It's kind of intentional to keep them.

Anyways, your proposal looks good too. I'll try them.

from php-docker.

tmatsuo avatar tmatsuo commented on August 14, 2024

I'm trying to implement it, but I get a feeling that it will require composer based app because

ONBUILD COPY composer.lock composer.json ${APP_DIR}

This line will fail if there are no such files.

I also want to support apps without composer.json (like WordPress!). What do you think?

from php-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.