WordPress/openverse-catalog

General Dockerfile improvements

Closed this issue · 0 comments

Current Situation

As it stands, our Dockerfile(s) are fairly typical. There are a few steps we could take to improve/optimize the image(s).

Suggested Improvement

  • Use PIPNOCACHEDIR1
  • Only mount test files when testing
  • Replace ADD with COPY 2
  • Only perform db init/users create when requested, otherwise use db upgrade

Benefit

This will slim down the image, ensure that we're using best practices, and reduce redundant startup executions.

Alternatives

Additional context

Implementation

  • 🙋 I would be interested in implementing this feature.

Footnotes

  1. https://stackoverflow.com/a/45594808/3277713

  2. https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy