pacuna/rails5-docker-alpine

Reasoning behind tmp folder usage

Closed this issue · 1 comments

I'm still fairly new to Docker, and I'm wondering if there's a bit I can learn from your process. I'm referring to these lines in the Dockerfile:

WORKDIR /tmp
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install --jobs 4 --retry 3

# Copy the application into the container
COPY . /usr/src/app
WORKDIR /usr/src/app

Whereas my approach is usually:

WORKDIR /app
COPY Gemfile /app/
COPY Gemfile.lock /app/
RUN bundle install --jobs 4 --retry 3
COPY . /app

Is there a benefit of your approach over my approach?
Is my approach more/less efficient?
Does my approach have issues that I haven't uncovered yet?

Hi,
It should be exactly the same result I think.
It's just a habit of mine from the first time that I learn about Docker and Rails and read posts like these:

But they also don't mention if using a tmp directory has some benefit.
Anyway, I did some refactoring for the path app and use the same path for simplicity. Thanks!