Bioconductor / OrchestratingSingleCellAnalysis

Content for the OSCA Book.
http://bioconductor.org/books/devel/OSCA/
65 stars 36 forks source link

Update Dockerfile #34

Closed nturaga closed 4 years ago

nturaga commented 4 years ago

Using fromlatest.io (https://www.fromlatest.io/#/) which enforces best practices for the Dockerfile.

I haven't built it to test locally, but this should produce a "cleaner" and more efficient image.

LTLA commented 4 years ago

Is there a benefit from chaining the multiple R installation calls?

nturaga commented 4 years ago

Yes, there is. This makes use of Docker’s built-in caching mechanisms. It works on an AUFS file system, where each RUN command adds a "layer".

You could do it the inefficient way by adding this to your Dockerfile. That’s going to bloat your image and make 3 separate layers because there are 3 RUN instructions.

RUN sudo apt-get update
RUN sudo apt-get install -y libglpk-dev
RUN rm -rf /var/lib/apt/lists/*

Instead, you could chain things together. Docker will only create 1 layer, and you still performed all 3 tasks. Shrinkage! You’ll sometimes get faster build times if the RUN commands were significantly large because each layer adds a bit of build time.

RUN apt-get update \
  && apt-get install --no-install-recommends -y libglpk-dev \
  && rm -rf /var/lib/apt/lists/*

Also, Docker "best practices" and all that jazz.

LTLA commented 4 years ago

Okay, that's good enough for me.