alphafold icon indicating copy to clipboard operation
alphafold copied to clipboard

reduce docker image size

Open TheDen opened this issue 1 year ago • 1 comments

PR reduces docker image size—a summary of the changes

  • Adds pipefail to the SHELL directive for safety
  • Added --no-install-recommends to apt and autoremove+clean as per best practices
  • Adds conda clean -afy to remove cache files, package tarballs, and the entire package cache. To ensure only necessary files are saved in each layer. Ref
  • Added --no-cache-dir to the pip installs since the pip cache isn't needed for a docker image
  • Merged the two consecutive RUN directives into one
  • Added quotes around various strings to ensure splitting doesn't occur

Followed rules from hadolint and shellcheck

Running DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build -f docker/Dockerfile -t alphafold . --no-cache (note the DOCKER_DEFAULT_PLATFORM=linux/amd64 is used because I'm on a M1 MacBook) for the existing Dockerfile, and and the updated one (with the tag alphafold-new ) here's the difference in size after the changes (9.77GB vs 12.5GB)

$ docker images | grep alphafold
alphafold-new                                                                latest                              e823bb581ba2   12 minutes ago   9.77GB
alphafold                                                                    latest                              7ecff97027f2   45 minutes ago   12.5GB

TheDen avatar Jul 06 '22 18:07 TheDen

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Jul 06 '22 18:07 google-cla[bot]

Thanks for this PR! These suggestions have been included in https://github.com/deepmind/alphafold/releases/tag/v2.2.4

Htomlinson14 avatar Sep 21 '22 16:09 Htomlinson14