3 ms·
in Docker that would be something like COPY Gemfile Gemfile.lock /src RUN bundle install even if they don't use docker to run application in prod, it can
by rossmohax 7y ago
in Docker that would be something like
COPY Gemfile Gemfile.lock /src
RUN bundle install
even if they don't use docker to run application in prod, it can be [ab]used to perform efficient build layer (build step) caching and distribution.
- quickthrower2 7y agoProblem with docker is there if something early on changes then everything after needs to be rebuild. However with a build you might have A and B feed into C. If A changes and B hasn't you want to just build A and get B from cache.
- caleblloyd 7y agoOne solution in Docker is multistage builds where A and B can be separated into intermediate images with results copied into C. A pattern that I like to use is two multistage build Dockerfiles- `dev` and `prod`. The `dev` image has 2 stages. The first stage copies only files required by the package manager, such as `package.json` into another directory using a combination of `find` and `cp --parents`, then restores dependencies. The second stage copies the dependencies from the first stage and overlays source code. The `dev` image is then instantiated to run all tests. The `prod` image also has 2 stages. The first stage starts with the `dev` image and publishes a production bundle to a directory. The second stage starts with a clean image and copies the production bundle from the first stage.
- pasxizeis 7y agoThat's what a mistry recipe looks like, with some additional conventions (e.g. params are accessible in the project as files located in `/data/params`). mistry recipes are essentially Dockerfiles.