[FIX] pull postgres image if doesn't exist

This commit is contained in:
Sylvain LE GAL 2022-06-17 00:15:38 +02:00
parent 28aee38a81
commit 715b080abc
2 changed files with 10 additions and 1 deletions

View File

@ -5,7 +5,7 @@ from odoo_openupgrade_wizard.cli_options import (
get_odoo_versions_from_options,
releases_options,
)
from odoo_openupgrade_wizard.tools_docker import build_image
from odoo_openupgrade_wizard.tools_docker import build_image, pull_image
from odoo_openupgrade_wizard.tools_odoo import (
get_docker_image_tag,
get_odoo_env_path,
@ -18,6 +18,10 @@ from odoo_openupgrade_wizard.tools_odoo import (
def docker_build(ctx, releases):
"""Build Odoo Docker Images. (One image per release)"""
# Pull DB image
pull_image(ctx.obj["config"]["postgres_image_name"])
# Build images for each odoo version
for odoo_version in get_odoo_versions_from_options(ctx, releases):
logger.info(
"Building Odoo docker image for release '%s'. "

View File

@ -6,6 +6,11 @@ def get_docker_client():
return docker.from_env()
def pull_image(image_name):
client = get_docker_client()
client.images.pull(image_name)
def build_image(path, tag):
logger.debug(
"Building image named based on %s/Dockerfile."