Merge pull request #18 from ERPLibre/fix_docker_poetry_1_0_10

[FIX] install locally poetry to force version 1.0.10
This commit is contained in:
Mathieu Benoit 2020-11-01 00:08:28 -04:00 committed by GitHub
commit 26029241e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 51 additions and 20 deletions

View file

@ -11,6 +11,9 @@ services:
PASSWORD: mysecretpassword
USER: odoo
POSTGRES_DB: postgres
STOP_BEFORE_INIT: "False"
DB_NAME: ""
UPDATE_ALL_DB: "False"
depends_on:
- db
command: odoo

View file

@ -85,7 +85,7 @@ RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/
&& rm -rf /var/lib/apt/lists/*
# Install npm dependencies
RUN sudo npm install -g rtlcss less \
RUN npm install -g rtlcss less \
&& ln -fs /usr/local/bin/lessc /usr/bin/lessc
# Install python with pyenv
@ -114,7 +114,7 @@ RUN groupadd --gid 101 --force odoo && \
# TODO delete poetry installation
# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
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

View file

@ -2,7 +2,9 @@ FROM technolibre/erplibre-base:1.1.0
ENV REPO_MANIFEST_URL http://git.erplibre.ca/ERPLibre
ARG WORKING_BRANCH
ARG WORKING_HASH
ENV BRANCH_ERPLIBRE $WORKING_BRANCH
ENV COMMIT_ERPLIBRE $WORKING_HASH
RUN cat /etc/os-release
@ -12,13 +14,15 @@ 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/*
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" && \
git clone $REPO_MANIFEST_URL -b $BRANCH_ERPLIBRE $ODOO_PREFIX
git config --global user.email "foo@bar.io" && \
git config --global user.name "Foo Bar" && \
if [ "$BRANCH_ERPLIBRE" = "HEAD" ]; then git clone $REPO_MANIFEST_URL $ODOO_PREFIX ; else git clone $REPO_MANIFEST_URL -b $BRANCH_ERPLIBRE $ODOO_PREFIX; fi && \
cd $ODOO_PREFIX && \
git checkout $COMMIT_ERPLIBRE
RUN cd $ODOO_PREFIX && \
python -m venv .venv

View file

@ -71,14 +71,29 @@ case "$1" in
exec odoo "$@" || exec odoo-bin "$@"
else
cd $ODOO_PREFIX
if [[ "${STOP_BEFORE_INIT}" == "True" ]] ; then
sleep 999999
fi
./docker/wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf
if [[ "${UPDATE_ALL_DB}" == "True" ]] ; then
# --stop-after-init
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf -u all -d "${DB_NAME}"
else
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf
fi
fi
;;
-*)
cd $ODOO_PREFIX
if [[ "${STOP_BEFORE_INIT}" == "True" ]] ; then
sleep 999999
fi
./docker/wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf
if [[ "${UPDATE_ALL_DB}" == "True" ]] ; then
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf -u all -d "${DB_NAME}"
else
exec ./.venv/bin/python $ODOO_EXEC_BIN "$@" "${DB_ARGS[@]}" -c /etc/odoo/odoo.conf
fi
;;
*)
exec "$@"

View file

@ -446,13 +446,13 @@ max_cron_threads = 1
# Prevents the worker from using more than <limit> CPU seconds for each
# request. If the limit is exceeded, the worker is killed
#-----------------------------------------------------------------------------
limit_time_cpu = 600
limit_time_cpu = 2400
#-----------------------------------------------------------------------------
# Prevents the worker from taking longer than <limit> seconds to process a
# request. If the limit is exceeded, the worker is killed.
#-----------------------------------------------------------------------------
limit_time_real = 900
limit_time_real = 3600
#-----------------------------------------------------------------------------
# Maximum allowed virtual memory per worker. If the limit is exceeded, the

View file

@ -1,15 +1,22 @@
#!/usr/bin/env bash
. ./env_var.sh
ARGS=""
for arg in "$@"
do
if [ "$arg" == "--no-cache" ]
then
ARGS="${ARGS} --no-cache"
fi
done
# Rewrite docker-compose
./script/docker_update_version.py --version=${ERPLIBRE_VERSION} --base=${ERPLIBRE_DOCKER_BASE} --prod=${ERPLIBRE_DOCKER_PROD}
cd docker
ARGS=--build-arg=WORKING_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Clear cache
# ARGS="${ARGS} --no-cache"
ARGS="${ARGS} --build-arg=WORKING_BRANCH=$(git rev-parse --abbrev-ref HEAD) --build-arg=WORKING_HASH=$(git rev-parse --verify HEAD)"
set -e

View file

@ -179,6 +179,7 @@ PYTHON_EXEC=${PYENV_VERSION_PATH}/bin/python
POETRY_PATH=~/.poetry
VENV_PATH=./.venv
VENV_REPO_PATH=${VENV_PATH}/repo
POETRY_VERSION=1.0.10
if [[ ! -d "${PYENV_PATH}" ]]; then
echo -e "\n---- Installing pyenv in ${PYENV_PATH} ----"
@ -198,10 +199,11 @@ fi
pyenv local 3.7.7
if [[ ! -d "${POETRY_PATH}" ]]; then
# Delete directory ~/.poetry and .venv to force update to new version
echo -e "\n---- Installing poetry for reliable python package ----"
# curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | ${PYTHON_EXEC}
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
python get-poetry.py -y --preview
python get-poetry.py -y --preview --version ${POETRY_VERSION}
fi
if [[ ! -d ${VENV_PATH} ]]; then

View file

@ -6,6 +6,6 @@
#EL_MANIFEST_DEV="./manifest/default.dev.xml"
# Update git-repo
./.venv/repo init -u http://git.erplibre.ca/ERPLibre -b $(git rev-parse --abbrev-ref HEAD) -m ${EL_MANIFEST_DEV}
./.venv/repo init -u http://git.erplibre.ca/ERPLibre -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_DEV}
#./.venv/repo sync --force-sync
./.venv/repo sync --force-sync -v

View file

@ -9,7 +9,7 @@
git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose &
DAEMON_PID=$!
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --abbrev-ref HEAD) -m ${EL_MANIFEST_DEV}
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_DEV}
./.venv/repo sync -v --force-sync -m ${EL_MANIFEST_DEV}
kill ${DAEMON_PID}

View file

@ -10,7 +10,7 @@
git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose &
DAEMON_PID=$!
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --abbrev-ref HEAD) -m ${EL_MANIFEST_EXP}
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_EXP}
./.venv/repo sync -v --force-sync -m ${EL_MANIFEST_EXP}
kill ${DAEMON_PID}

View file

@ -9,7 +9,7 @@
git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose &
DAEMON_PID=$!
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --abbrev-ref HEAD) -m ${EL_MANIFEST_PROD}
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_PROD}
./.venv/repo sync -v -m ${EL_MANIFEST_PROD}
kill ${DAEMON_PID}

View file

@ -6,6 +6,6 @@
#EL_MANIFEST_DEV="./manifest/default.dev.xml"
# Update git-repo
./.venv/repo init -u http://git.erplibre.ca/ERPLibre -b $(git rev-parse --abbrev-ref HEAD)
./.venv/repo init -u http://git.erplibre.ca/ERPLibre -b $(git rev-parse --verify HEAD)
#./.venv/repo sync --force-sync
./.venv/repo sync -v