diff options
author | Ulysses Souza <ulyssessouza@gmail.com> | 2021-04-01 03:16:05 -0300 |
---|---|---|
committer | Ulysses Souza <ulyssessouza@gmail.com> | 2021-04-05 12:34:45 -0300 |
commit | e496c641273326c7314e01f434313a56f48ba7b0 (patch) | |
tree | 29792afdf26f14e470c5c5c7c73a6f489602e732 /compose/service.py | |
parent | 84afa518e8144c9620562c023c0b62dd7c0b4305 (diff) |
Add Snyk scan suggestion when building
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
Diffstat (limited to 'compose/service.py')
-rw-r--r-- | compose/service.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/compose/service.py b/compose/service.py index 716a7557..fda1edb2 100644 --- a/compose/service.py +++ b/compose/service.py @@ -366,6 +366,24 @@ class Service: "rebuild this image you must use `docker-compose build` or " "`docker-compose up --build`.".format(self.name)) + def must_build(self, do_build=BuildAction.none): + if self.can_be_built() and do_build == BuildAction.force: + return True + + try: + self.image() + return False + except NoSuchImageError: + pass + + if not self.can_be_built(): + return False + + if do_build == BuildAction.skip: + return False + + return True + def get_image_registry_data(self): try: return self.client.inspect_distribution(self.image_name) |