Skip to content
Snippets Groups Projects
Commit 8425cd88 authored by Théo - Le Filament's avatar Théo - Le Filament
Browse files

build: small improvements

parent bbd1ac1b
No related branches found
No related tags found
No related merge requests found
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 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment