diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index b7b53b2..9982eb8 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -1,5 +1,5 @@ FROM debian:buster-slim -MAINTAINER Odoo S.A. +MAINTAINER TechnoLibre SHELL ["/bin/bash", "-xo", "pipefail", "-c"] @@ -9,76 +9,74 @@ ENV LANG C.UTF-8 ENV ODOO_PREFIX /ERPLibre ENV ODOO_EXEC_BIN $ODOO_PREFIX/odoo/odoo-bin - # Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - dirmngr \ - fonts-noto-cjk \ - gnupg \ - libssl-dev \ - node-less \ - 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 \ - iproute2 \ - inetutils-ping \ - && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb \ - && echo '7e35a63f9db14f93ec7feeb0fce76b30c08f2057 wkhtmltox.deb' | sha1sum -c - \ - && apt-get install -y --no-install-recommends ./wkhtmltox.deb \ - && rm -rf /var/lib/apt/lists/* wkhtmltox.deb - + && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + dirmngr \ + fonts-noto-cjk \ + gnupg \ + libssl-dev \ + node-less \ + 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 \ + iproute2 \ + inetutils-ping \ + && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb \ + && echo '7e35a63f9db14f93ec7feeb0fce76b30c08f2057 wkhtmltox.deb' | sha1sum -c - \ + && apt-get install -y --no-install-recommends ./wkhtmltox.deb \ + && rm -rf /var/lib/apt/lists/* wkhtmltox.deb # dpkg-deb -I odoo.deb | grep Depends: | sed "s/ /\\n/g" | egrep '^python\-*' | sed "s/,//g" RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - python3-dateutil \ - python3-decorator \ - python3-docutils \ - python3-feedparser \ - python3-gevent \ - python3-html2text \ - python3-jinja2 \ - python3-libsass \ - python3-lxml \ - python3-mako \ - python3-mock \ - python3-ofxparse \ - python3-passlib \ - python3-pil \ - python3-psutil \ - python3-psycopg2 \ - python3-pydot \ - python3-pyparsing \ - python3-pypdf2 \ - python3-reportlab \ - python3-requests \ - python3-serial \ - python3-suds \ - python3-tz \ - python3-usb \ - python3-vatnumber \ - python3-werkzeug \ - python3-xlsxwriter \ - python3-chardet \ - python3-xlrd \ - && rm -rf /var/lib/apt/lists/* + && apt-get install -y --no-install-recommends \ + python3-dateutil \ + python3-decorator \ + python3-docutils \ + python3-feedparser \ + python3-gevent \ + python3-html2text \ + python3-jinja2 \ + python3-libsass \ + python3-lxml \ + python3-mako \ + python3-mock \ + python3-ofxparse \ + python3-passlib \ + python3-pil \ + python3-psutil \ + python3-psycopg2 \ + python3-pydot \ + python3-pyparsing \ + python3-pypdf2 \ + python3-reportlab \ + python3-requests \ + python3-serial \ + python3-suds \ + python3-tz \ + python3-usb \ + python3-vatnumber \ + python3-werkzeug \ + python3-xlsxwriter \ + python3-chardet \ + python3-xlrd \ + && rm -rf /var/lib/apt/lists/* # install latest postgresql-client RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list \ @@ -91,35 +89,32 @@ RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/ && rm -rf "$GNUPGHOME" \ && apt-get update \ && apt-get install --no-install-recommends -y postgresql-client-12 \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* RUN ln -s /usr/lib/postgresql/12/bin/pg_config /usr/bin/pg_config RUN cd ; mkdir -p .bin/ && \ - git config --global color.ui false && \ - git config --global user.email "foo@bar.io" && \ - git config --global user.name "Foo Bar" && \ - curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo && \ - chmod +x /usr/bin/repo && sed -i '1 s/python$/python3/' /usr/bin/repo - + git config --global color.ui false && \ + git config --global user.email "foo@bar.io" && \ + git config --global user.name "Foo Bar" && \ + curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo && \ + chmod +x /usr/bin/repo && sed -i '1 s/python$/python3/' /usr/bin/repo RUN groupadd --gid 101 --force odoo && \ useradd --non-unique --create-home --uid 101 --gid 101 odoo - # Copy entrypoint script and Odoo configuration file COPY ./entrypoint.sh / RUN chmod +x /entrypoint.sh - # # Set the default config file ENV ODOO_RC /etc/odoo/odoo.conf COPY ./odoo.conf $ODOO_RC RUN chown odoo $ODOO_RC RUN mkdir $ODOO_PREFIX && \ - chown odoo $ODOO_PREFIX && \ - chmod 1777 $ODOO_PREFIX + chown odoo $ODOO_PREFIX && \ + chmod 1777 $ODOO_PREFIX # # Mount /var/lib/odoo to allow restoring filestore RUN chown odoo $ODOO_RC @@ -132,8 +127,8 @@ COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py RUN chmod +X /usr/local/bin/wait-for-psql.py RUN mkdir -p /var/lib/odoo && \ - chown odoo /var/lib/odoo && \ - chmod 1777 /var/lib/odoo + chown odoo /var/lib/odoo && \ + chmod 1777 /var/lib/odoo VOLUME /var/lib/odoo diff --git a/docker/Dockerfile.prod.pkg b/docker/Dockerfile.prod.pkg index 5fb995d..4633e40 100644 --- a/docker/Dockerfile.prod.pkg +++ b/docker/Dockerfile.prod.pkg @@ -1,9 +1,10 @@ FROM technolibre/erplibre-base:12.0 ENV REPO_MANIFEST_URL http://git.erplibre.ca/ERPLibre -RUN cat /etc/os-release ENV BRANCH_ERPLIBRE dev/1.1.0 +RUN cat /etc/os-release + USER root # Install Odoo @@ -17,21 +18,21 @@ USER root # && rm -rf /var/lib/apt/lists/* odoo.deb -RUN mkdir ~/.ssh/ && echo "StrictHostKeyChecking no" >> ~/.ssh/config && apt update && apt install ssh-client git -y --no-install-recommends && \ +RUN mkdir ~/.ssh/ && echo "StrictHostKeyChecking no" >> ~/.ssh/config && apt update && apt install ssh-client git -y --no-install-recommends && \ rm -rf /var/lib/apt/lists/* RUN cd ; mkdir -p .bin/ && \ - git config --global color.ui false && \ - git config --global user.email "foo@bar.io" && \ - git config --global user.name "Foo Bar" && \ - mkdir -p $ODOO_PREFIX && cd $ODOO_PREFIX && \ - repo init -u $REPO_MANIFEST_URL -b $BRANCH_ERPLIBRE && \ - repo sync -j 4 -c + git config --global color.ui false && \ + git config --global user.email "mathben@technolibre.ca" && \ + git config --global user.name "Mathieu Benoit" && \ + mkdir -p $ODOO_PREFIX && cd $ODOO_PREFIX && \ + repo init -u $REPO_MANIFEST_URL -b $BRANCH_ERPLIBRE && \ + repo sync -j 4 -c ADD repo_manifest_gen_org_prefix_path.py /root/.bin/ RUN chmod +x ~/.bin/repo_manifest_gen_org_prefix_path.py -RUN head /etc/odoo/odoo.conf && /root/.bin/repo_manifest_gen_org_prefix_path.py $ODOO_PREFIX/addons /etc/odoo/odoo.conf /etc/odoo/odoo.conf && head /etc/odoo/odoo.conf +RUN head /etc/odoo/odoo.conf && /root/.bin/repo_manifest_gen_org_prefix_path.py $ODOO_PREFIX/addons /etc/odoo/odoo.conf /etc/odoo/odoo.conf && head /etc/odoo/odoo.conf user odoo diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index d449f71..6d30621 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -10,7 +10,7 @@ then git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose & GIT_PID=$! echo "my repo" $(git rev-parse --abbrev-ref HEAD) - repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --abbrev-ref HEAD) -m default.dev.xml + repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --abbrev-ref HEAD) -m default.dev.xml repo sync diff --git a/docker/repo_manifest_gen_org_prefix_path.py b/docker/repo_manifest_gen_org_prefix_path.py index 979a5b3..27522e5 100755 --- a/docker/repo_manifest_gen_org_prefix_path.py +++ b/docker/repo_manifest_gen_org_prefix_path.py @@ -2,25 +2,26 @@ import argparse - from os import listdir from os.path import isdir, join, abspath - import configparser parser = argparse.ArgumentParser(prog='Configure base dir for all addons') -parser.add_argument("addonsBaseDir", help="Path where addons are checkouted") -parser.add_argument("srcConfigPath", help="Path where we retreive source config file to adapt with new addons path") -parser.add_argument("dstConfigPath", help="Path to save adapted cpnfiguration") +parser.add_argument("addonsBaseDir", help="Path where addons are cloned.") +parser.add_argument("srcConfigPath", + help="Path where we retrieve source config file to adapt with new " + "addons path.") +parser.add_argument("dstConfigPath", help="Path to save adapted configuration.") args = parser.parse_args() addonsBaseDir = args.addonsBaseDir srcConfigPath = args.srcConfigPath dstConfigPath = args.dstConfigPath -addonsDirs = [ abspath(join(addonsBaseDir, f)) for f in listdir(addonsBaseDir) if isdir(join(addonsBaseDir, f))] +addonsDirs = [abspath(join(addonsBaseDir, f)) for f in listdir(addonsBaseDir) if + isdir(join(addonsBaseDir, f))] # addonsDirs.insert(0, "/usr/lib/python3/dist-packages/odoo/addons/") addonsDirs.insert(0, "/ERPLibre/odoo/addons/") @@ -33,7 +34,7 @@ separator = "," config.set('options', 'addons_path', separator.join(addonsDirs)) -print(config.get('options', 'addons_path' )) +print(config.get('options', 'addons_path')) with open(dstConfigPath, 'w') as configfile: config.write(configfile) diff --git a/docker/wait-for-psql.py b/docker/wait-for-psql.py index b936854..5f149ad 100755 --- a/docker/wait-for-psql.py +++ b/docker/wait-for-psql.py @@ -10,7 +10,7 @@ if __name__ == '__main__': arg_parser.add_argument('--db_port', required=True) arg_parser.add_argument('--db_user', required=True) arg_parser.add_argument('--db_password', required=True) - # arg_parser.add_argument('--db_name', required=True) + arg_parser.add_argument('--db_name', required=False, default="postgres") arg_parser.add_argument('--timeout', type=int, default=10) args = arg_parser.parse_args() @@ -24,17 +24,15 @@ if __name__ == '__main__': try: conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, - dbname="postgres") - + dbname=args.db_name) break except psycopg2.OperationalError as e: error = e + print(".") + time.sleep(1) else: connected = True conn.close() - print(".") - time.sleep(1) - if error: print("Database connection failure: %s" % error, file=sys.stderr) sys.exit(1)