[FIX] call pip install with -r and not -e; [IMP] adapt apt-get update call to old buggy images with '|| true' ; [IMP] install correctly openupgradelib on old images (https://github.com/OCA/openupgradelib/issues/248)

This commit is contained in:
Sylvain LE GAL 2022-04-09 02:29:20 +02:00
parent 917692d0fb
commit 212f18ff1c
2 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,13 @@
from pathlib import Path from pathlib import Path
# See : https://github.com/OCA/openupgradelib/issues/248
# https://github.com/OCA/openupgradelib/issues/288
_LEGACY_OPENUPGRADELIB = (
"git+https://github.com/OCA/openupgradelib.git"
"@ed01555b8ae20f66b3af178c8ecaf6edd110ce75#egg=openupgradelib"
)
# List of the series of odoo # List of the series of odoo
# python version is defined, based on the OCA CI. # python version is defined, based on the OCA CI.
# https://github.com/OCA/oca-addons-repo-template/blob/master/src/.github/workflows/%7B%25%20if%20ci%20%3D%3D%20'GitHub'%20%25%7Dtest.yml%7B%25%20endif%20%25%7D.jinja # https://github.com/OCA/oca-addons-repo-template/blob/master/src/.github/workflows/%7B%25%20if%20ci%20%3D%3D%20'GitHub'%20%25%7Dtest.yml%7B%25%20endif%20%25%7D.jinja
@ -7,17 +15,17 @@ _ODOO_VERSION_TEMPLATES = [
{ {
"release": 8.0, "release": 8.0,
"python_major_version": "python2", "python_major_version": "python2",
"python_libraries": ["openupgradelib"], "python_libraries": [_LEGACY_OPENUPGRADELIB],
}, },
{ {
"release": 9.0, "release": 9.0,
"python_major_version": "python2", "python_major_version": "python2",
"python_libraries": ["openupgradelib"], "python_libraries": [_LEGACY_OPENUPGRADELIB],
}, },
{ {
"release": 10.0, "release": 10.0,
"python_major_version": "python2", "python_major_version": "python2",
"python_libraries": ["openupgradelib"], "python_libraries": [_LEGACY_OPENUPGRADELIB],
}, },
{ {
"release": 11.0, "release": 11.0,

View File

@ -65,10 +65,16 @@ PYTHON_REQUIREMENTS_TXT_TEMPLATE = """
{% endfor %} {% endfor %}
""" """
DEBIAN_REQUIREMENTS_TXT_TEMPLATE = "" DEBIAN_REQUIREMENTS_TXT_TEMPLATE = """
git
"""
ODOO_CONFIG_TEMPLATE = "" ODOO_CONFIG_TEMPLATE = ""
# Technical Notes:
# - We set apt-get update || true, because for some release (at least odoo:10)
# the command update fail, because of obsolete postgresql repository.
DOCKERFILE_TEMPLATE = """ DOCKERFILE_TEMPLATE = """
FROM odoo:{{ odoo_version['release'] }} FROM odoo:{{ odoo_version['release'] }}
MAINTAINER GRAP, Coop It Easy MAINTAINER GRAP, Coop It Easy
@ -83,12 +89,12 @@ COPY debian_requirements.txt /debian_requirements.txt
COPY python_requirements.txt /python_requirements.txt COPY python_requirements.txt /python_requirements.txt
# 2. Install extra debian packages # 2. Install extra debian packages
RUN apt-get update &&\ RUN apt-get update || true &&\
xargs apt-get install -y --no-install-recommends <debian_requirements.txt xargs apt-get install -y --no-install-recommends <debian_requirements.txt
# 3. Install extra Python librairies # 3. Install extra Python librairies
RUN {{ odoo_version["python_major_version"] }}\ RUN {{ odoo_version["python_major_version"] }}\
-m pip install -e python_requirements.txt -m pip install -r python_requirements.txt
# Reset to odoo user to run the container # Reset to odoo user to run the container
USER odoo USER odoo