lundi 22 janvier 2018

Should I include tests in Docker image?

When it comes to tests, I can think of two options:

  1. Put both test and application in one image.
  2. Include only application code in the image. Create a test-specific container that builds after the main image and adds some layers to it (test code, dependencies etc).

With the first option, I can test the container and ship it exactly as tested. An obvious downside is unnecessary code (and potentially test data) will be included in the image.

With the second option, the image that is shipped is not quite the same as the one that is tested.

Both look like bad strategies. Is there a third, better strategy?

Aucun commentaire:

Enregistrer un commentaire