From 8425cd88bdda2e4beca9dc5aed5137a108fcadf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20-=20Le=20Filament?= <theo@le-filament.com> Date: Tue, 30 Jul 2024 17:45:19 +0200 Subject: [PATCH] build: small improvements --- 16.0.Dockerfile | 68 +++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/16.0.Dockerfile b/16.0.Dockerfile index d6a46f5..6733146 100644 --- a/16.0.Dockerfile +++ b/16.0.Dockerfile @@ -1,46 +1,47 @@ FROM python:3.11-slim-bullseye AS builder RUN set -x; \ - apt-get update &&\ - apt-get install -y --no-install-recommends build-essential libldap2-dev libpq-dev libsasl2-dev &&\ - pip install wheel &&\ - pip wheel --wheel-dir=/svc/wheels -r https://raw.githubusercontent.com/oca/OCB/16.0/requirements.txt &&\ - # astor required by base_view_inheritance_extension - # openupgradelib required for OCA module migration from one version to another - # phonenumbers required by phone_validation - # python-stdnum>=1.18 required by l10n_fr_siret and l10n_fr_siret_lookup - # PyYAML required by custom scripts for adding modules (https://sources.le-filament.com/lefilament/ansible-roles/docker_odoo/-/tree/master/templates) - # zxcvbn required by password_security - pip wheel --wheel-dir=/svc/wheels 'astor' 'openupgradelib' 'phonenumbers' 'python-stdnum>=1.18' 'PyYAML' 'zxcvbn' + apt-get update \ + && apt-get install --yes --no-install-recommends build-essential libldap2-dev libpq-dev libsasl2-dev \ + && pip install wheel \ + && pip wheel --wheel-dir=/svc/wheels --requirement 'https://raw.githubusercontent.com/oca/OCB/16.0/requirements.txt' \ + # astor required by base_view_inheritance_extension + # openupgradelib required for OCA module migration from one version to another + # phonenumbers required by phone_validation + # python-stdnum>=1.18 required by l10n_fr_siret and l10n_fr_siret_lookup + # PyYAML required by custom scripts for adding modules (https://sources.le-filament.com/lefilament/ansible-roles/docker_odoo/-/tree/master/templates) + # zxcvbn required by password_security + && pip wheel --wheel-dir=/svc/wheels 'astor' 'openupgradelib' 'phonenumbers' 'python-stdnum>=1.18' 'PyYAML' 'zxcvbn' FROM python:3.11-slim-bullseye AS final -ARG SAVE_COMMITS_DIR='/opt/odoo_commits/' ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ - PGDATABASE=odoo \ - SAVE_COMMITS_DIR=$SAVE_COMMITS_DIR + PGDATABASE=odoo RUN set -x; \ - apt-get update &&\ - apt-get install -y --no-install-recommends \ - curl \ - git \ - gnupg \ - openssh-client \ - xmlsec1 &&\ - echo 'deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main' >> /etc/apt/sources.list.d/postgresql.list &&\ - curl -SL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - &&\ - curl -o wkhtmltox.deb -SL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb &&\ - echo 'cecbf5a6abbd68d324a7cd6c51ec843d71e98951 wkhtmltox.deb' | sha1sum -c - &&\ - apt-get update &&\ - apt-get install -y --no-install-recommends ./wkhtmltox.deb &&\ - apt-get install -y --no-install-recommends postgresql-client &&\ - apt-get -y autoremove &&\ - rm -rf /var/lib/apt/lists/* wkhtmltox.deb + apt-get update \ + && apt-get install --yes --no-install-recommends \ + curl \ + git \ + gnupg \ + openssh-client \ + xmlsec1 \ + && echo 'deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main' >> /etc/apt/sources.list.d/postgresql.list \ + && curl -SL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ + && curl -o wkhtmltox.deb -SL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb \ + && echo 'cecbf5a6abbd68d324a7cd6c51ec843d71e98951 wkhtmltox.deb' | sha1sum -c - \ + && apt-get update \ + && apt-get install --yes --no-install-recommends ./wkhtmltox.deb \ + && apt-get install --yes --no-install-recommends postgresql-client \ + && apt-get --yes autoremove \ + && rm -rf /var/lib/apt/lists/* wkhtmltox.deb COPY --from=builder /svc /svc -RUN pip3 install --no-index --find-links=/svc/wheels -r https://raw.githubusercontent.com/oca/OCB/16.0/requirements.txt &&\ - pip3 install -U --no-index --find-links=/svc/wheels 'astor' 'openupgradelib' 'phonenumbers' 'python-stdnum>=1.18' 'PyYAML' 'zxcvbn' +RUN pip3 install --no-index --find-links=/svc/wheels --requirement 'https://raw.githubusercontent.com/oca/OCB/16.0/requirements.txt' \ + && pip3 install --upgrade --no-index --find-links=/svc/wheels 'astor' 'openupgradelib' 'phonenumbers' 'python-stdnum>=1.18' 'PyYAML' 'zxcvbn' + +ARG SAVE_COMMITS_DIR='/opt/odoo_commits/' +ENV SAVE_COMMITS_DIR=$SAVE_COMMITS_DIR # Add Git Known Hosts COPY ./ssh_known_git_hosts /root/.ssh/known_hosts @@ -49,10 +50,11 @@ COPY ./ssh_known_git_hosts /root/.ssh/known_hosts ARG SAVE_COMMITS_FILENAME='ocb' RUN set -x; \ repo='https://github.com/OCA/OCB' \ + branch='16.0' \ && useradd --create-home --home-dir /opt/odoo --no-log-init odoo \ && /bin/bash -c "mkdir -p /opt/odoo/{etc,odoo,additional_addons,private_addons,data,private}" \ && mkdir /opt/odoo_commits \ - && git clone --single-branch --branch '16.0' --depth 1 "${repo}" /tmp/repo \ + && git clone --single-branch --branch "${branch}" --depth 1 "${repo}" /tmp/repo \ && commit="$(git -C /tmp/repo rev-parse HEAD)" \ && mv /tmp/repo/* /opt/odoo/odoo/ \ && echo "${repo};${commit}" > $SAVE_COMMITS_DIR/$SAVE_COMMITS_FILENAME \ -- GitLab