From f7d70086fdf779c081d820ecbde730372db9a21a Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sun, 27 Jun 2021 16:51:30 -0400 Subject: [PATCH] [FIX] docker build, update dependencies and fix poetry - Use image with python 3.7.7 instead of using pyenv --- docker/Dockerfile.base | 47 +++++++-------------- docker/Dockerfile.prod.pkg | 17 +++++++- docker/repo_manifest_gen_org_prefix_path.py | 2 +- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 3f992b8..f6e408a 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM python:3.7.7-slim-buster MAINTAINER TechnoLibre SHELL ["/bin/bash", "-xo", "pipefail", "-c"] @@ -25,29 +25,19 @@ RUN apt-get update \ gnupg \ libssl-dev \ npm \ - python3-num2words \ - python3-pip \ - python3-phonenumbers \ - python3-pyldap \ - python3-qrcode \ - python3-renderpm \ - python3-setuptools \ - python3-slugify \ - python3-vobject \ - python3-watchdog \ - python3-xlrd \ - python3-xlwt \ - python3-babel \ - python3-psycopg2 \ xz-utils \ git \ wget \ + make \ + libssl-dev \ + zlib1g-dev \ + llvm \ + tk-dev \ libxslt-dev \ libzip-dev \ libldap2-dev \ libsasl2-dev \ gdebi-core \ - libffi-dev \ iproute2 \ libmariadbd-dev \ inetutils-ping \ @@ -85,21 +75,21 @@ RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/ && rm -rf /var/lib/apt/lists/* # Install npm dependencies -RUN npm install -g rtlcss less \ +RUN npm install -g rtlcss less prettier @prettier/plugin-xml \ && ln -fs /usr/local/bin/lessc /usr/bin/lessc # Install python with pyenv # Reference https://github.com/bopen/docker-ubuntu-pyenv -COPY pyenv-version.txt python-versions.txt / +#COPY pyenv-version.txt python-versions.txt / -RUN git clone -b `cat /pyenv-version.txt` --single-branch --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT \ - && for version in `cat /python-versions.txt`; do pyenv install $version; done \ - && pyenv global `cat /python-versions.txt` \ - && find $PYENV_ROOT/versions -type d '(' -name '__pycache__' -o -name 'test' -o -name 'tests' ')' -exec rm -rf '{}' + \ - && find $PYENV_ROOT/versions -type f '(' -name '*.pyo' -o -name '*.exe' ')' -exec rm -f '{}' + \ - && rm -rf /tmp/* \ - && python --version \ - && python3 --version +#RUN git clone -b `cat /pyenv-version.txt` --single-branch --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT \ +# && for version in `cat /python-versions.txt`; do pyenv install $version; done \ +# && pyenv global `cat /python-versions.txt` \ +# && find $PYENV_ROOT/versions -type d '(' -name '__pycache__' -o -name 'test' -o -name 'tests' ')' -exec rm -rf '{}' + \ +# && find $PYENV_ROOT/versions -type f '(' -name '*.pyo' -o -name '*.exe' ')' -exec rm -f '{}' + \ +# && rm -rf /tmp/* \ +# && python --version \ +# && python3 --version # Install git-repo RUN cd ; mkdir -p .bin/ && \ @@ -112,11 +102,6 @@ RUN cd ; mkdir -p .bin/ && \ RUN groupadd --gid 101 --force odoo && \ useradd --non-unique --create-home --uid 101 --gid 101 odoo -# TODO delete poetry installation -# Install Poetry -RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - -y --preview --version 1.0.10 -#curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py - # Copy entrypoint script and Odoo configuration file COPY ./entrypoint.sh / RUN chmod +x /entrypoint.sh diff --git a/docker/Dockerfile.prod.pkg b/docker/Dockerfile.prod.pkg index f9a3c30..9706f67 100644 --- a/docker/Dockerfile.prod.pkg +++ b/docker/Dockerfile.prod.pkg @@ -34,9 +34,22 @@ RUN cd $ODOO_PREFIX && \ RUN cd $ODOO_PREFIX && \ ./script/update_manifest_dev.sh +# TODO delete poetry installation +# Install Poetry RUN cd $ODOO_PREFIX && \ - source /root/.poetry/env && \ - poetry install + curl -sSL -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py && \ + ./.venv/bin/python get-poetry.py -y --preview --version 1.0.10 + +RUN cd $ODOO_PREFIX && \ + ./.venv/bin/pip install --upgrade pip && \ + ./.venv/bin/python ~/.poetry/bin/poetry install && \ + rm -rf artifacts + +RUN cd $ODOO_PREFIX/.venv && \ + curl https://raw.githubusercontent.com/ERPLibre/multilingual-markdown/master/multilang_md.py > ./multilang_md.py && \ + chmod +x ./multilang_md.py && \ + sed -i 1d ./multilang_md.py && \ + sed -i "1 i #!./.venv/bin/python" ./multilang_md.py RUN cd $ODOO_PREFIX && \ head /etc/odoo/odoo.conf && \ diff --git a/docker/repo_manifest_gen_org_prefix_path.py b/docker/repo_manifest_gen_org_prefix_path.py index 7838e11..01b323a 100755 --- a/docker/repo_manifest_gen_org_prefix_path.py +++ b/docker/repo_manifest_gen_org_prefix_path.py @@ -25,7 +25,7 @@ addonsDirs = [abspath(join(addonsBaseDir, f)) for f in listdir(addonsBaseDir) if # addonsDirs.insert(0, "/usr/lib/python3/dist-packages/odoo/addons/") # TODO path addons/addons is not exist in docker, so force to add it -addonsDirs.insert(0, "/ERPLibre/addons/addons") +# addonsDirs.insert(0, "/ERPLibre/addons/addons") addonsDirs.insert(0, "/ERPLibre/odoo/addons/") config = configparser.ConfigParser()