odoo / docker

Other
931 stars 1.51k forks source link

[IMP] Install testing requirements into separate image. #409

Open amh-mw opened 2 years ago

amh-mw commented 2 years ago

Fixes #277

amh-mw commented 2 years ago

~I'm still playing around with this a bit, so I've included two versions of the work.~

~In version one, the main Dockerfile is converted into a multi-stage build, which would require existing build processes to add --target=web.~

In version two, an entirely separate test.Dockerfile is created. This is more similar to what my own build process currently looks like.

amh-mw commented 2 years ago

Some workflows to consider:

When I'm developing locally, I don't want to repeatedly reinstall chromium, so my image inheritance looks like: odoo:15 -> odoo:test -> me:latest

When I'm pushing code, I don't want chromium in production, but I want to test an image that is very similar: odoo:15 -> me:latest -> me:test Run tests on me:test, but push me:latest into the image repository.

amh-mw commented 2 years ago

This is working nicely for me with a .travis.yml containing:

script:
  - docker build . --tag=me:travis || travis_terminate 1
  - docker build . -f test.Dockerfile --build-arg=image=me:travis --tag=me:test || travis_terminate 1
  - docker-compose -f docker-compose.travis.yaml run test || travis_terminate 1