Merge branch 'master' into master
This commit is contained in:
commit
2e9fc3ada2
@ -1,55 +0,0 @@
|
|||||||
FROM debian:jessie
|
|
||||||
MAINTAINER Odoo S.A. <info@odoo.com>
|
|
||||||
|
|
||||||
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
|
||||||
RUN set -x; \
|
|
||||||
apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates \
|
|
||||||
curl \
|
|
||||||
node-less \
|
|
||||||
python-gevent \
|
|
||||||
python-pip \
|
|
||||||
python-renderpm \
|
|
||||||
python-support \
|
|
||||||
python-watchdog \
|
|
||||||
&& curl -o wkhtmltox.deb -SL http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb \
|
|
||||||
&& echo '40e8b906de658a2221b15e4e8cd82565a47d7ee8 wkhtmltox.deb' | sha1sum -c - \
|
|
||||||
&& dpkg --force-depends -i wkhtmltox.deb \
|
|
||||||
&& apt-get -y install -f --no-install-recommends \
|
|
||||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false npm \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb \
|
|
||||||
&& pip install psycogreen==1.0
|
|
||||||
|
|
||||||
# Install Odoo
|
|
||||||
ENV ODOO_VERSION 10.0
|
|
||||||
ENV ODOO_RELEASE 20181109
|
|
||||||
RUN set -x; \
|
|
||||||
curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
|
||||||
&& echo '8b24a5a3e36aed8986d3d6b19c8a255ee72cd658 odoo.deb' | sha1sum -c - \
|
|
||||||
&& dpkg --force-depends -i odoo.deb \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get -y install -f --no-install-recommends \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* odoo.deb
|
|
||||||
|
|
||||||
# Copy entrypoint script and Odoo configuration file
|
|
||||||
COPY ./entrypoint.sh /
|
|
||||||
COPY ./odoo.conf /etc/odoo/
|
|
||||||
RUN chown odoo /etc/odoo/odoo.conf
|
|
||||||
|
|
||||||
# Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
|
|
||||||
RUN mkdir -p /mnt/extra-addons \
|
|
||||||
&& chown -R odoo /mnt/extra-addons
|
|
||||||
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
|
|
||||||
|
|
||||||
# Expose Odoo services
|
|
||||||
EXPOSE 8069 8071
|
|
||||||
|
|
||||||
# Set the default config file
|
|
||||||
ENV ODOO_RC /etc/odoo/odoo.conf
|
|
||||||
|
|
||||||
# Set default user when running the container
|
|
||||||
USER odoo
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
CMD ["odoo"]
|
|
@ -1,35 +1,59 @@
|
|||||||
FROM debian:stretch
|
FROM debian:stretch-slim
|
||||||
MAINTAINER Odoo S.A. <info@odoo.com>
|
MAINTAINER Odoo S.A. <info@odoo.com>
|
||||||
|
|
||||||
# Generate locale C.UTF-8 for postgres and general locale data
|
# Generate locale C.UTF-8 for postgres and general locale data
|
||||||
ENV LANG C.UTF-8
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
|
# Use backports to avoid install some libs with pip
|
||||||
|
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
|
||||||
|
|
||||||
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
||||||
RUN set -x; \
|
RUN set -x; \
|
||||||
apt-get update \
|
apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
node-less \
|
dirmngr \
|
||||||
python3-pip \
|
fonts-noto-cjk \
|
||||||
python3-setuptools \
|
gnupg \
|
||||||
python3-renderpm \
|
|
||||||
libssl1.0-dev \
|
libssl1.0-dev \
|
||||||
xz-utils \
|
node-less \
|
||||||
|
python3-num2words \
|
||||||
|
python3-pip \
|
||||||
|
python3-phonenumbers \
|
||||||
|
python3-pyldap \
|
||||||
|
python3-qrcode \
|
||||||
|
python3-renderpm \
|
||||||
|
python3-setuptools \
|
||||||
|
python3-vobject \
|
||||||
python3-watchdog \
|
python3-watchdog \
|
||||||
&& curl -o wkhtmltox.tar.xz -SL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
|
python3-xlwt \
|
||||||
&& echo '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum -c - \
|
xz-utils \
|
||||||
&& tar xvf wkhtmltox.tar.xz \
|
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb \
|
||||||
&& cp wkhtmltox/lib/* /usr/local/lib/ \
|
&& echo '7e35a63f9db14f93ec7feeb0fce76b30c08f2057 wkhtmltox.deb' | sha1sum -c - \
|
||||||
&& cp wkhtmltox/bin/* /usr/local/bin/ \
|
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
|
||||||
&& cp -r wkhtmltox/share/man/man1 /usr/local/share/man/
|
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb
|
||||||
|
|
||||||
|
# install latest postgresql-client
|
||||||
|
RUN set -x; \
|
||||||
|
echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' > etc/apt/sources.list.d/pgdg.list \
|
||||||
|
&& export GNUPGHOME="$(mktemp -d)" \
|
||||||
|
&& repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
|
||||||
|
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
|
||||||
|
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
|
||||||
|
&& gpgconf --kill all \
|
||||||
|
&& rm -rf "$GNUPGHOME" \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y postgresql-client \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Odoo
|
# Install Odoo
|
||||||
ENV ODOO_VERSION 11.0
|
ENV ODOO_VERSION 11.0
|
||||||
ENV ODOO_RELEASE 20181109
|
ARG ODOO_RELEASE=20191106
|
||||||
|
ARG ODOO_SHA=d6da6c631fb9926c4440f2016d623c37fa38d4ea
|
||||||
RUN set -x; \
|
RUN set -x; \
|
||||||
curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
||||||
&& echo '04823230d99d16dbaf157c55cfad632db4559060 odoo.deb' | sha1sum -c - \
|
&& echo "${ODOO_SHA} odoo.deb" | sha1sum -c - \
|
||||||
&& dpkg --force-depends -i odoo.deb \
|
&& dpkg --force-depends -i odoo.deb \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get -y install -f --no-install-recommends \
|
&& apt-get -y install -f --no-install-recommends \
|
||||||
@ -53,6 +77,8 @@ EXPOSE 8069 8071
|
|||||||
# Set the default config file
|
# Set the default config file
|
||||||
ENV ODOO_RC /etc/odoo/odoo.conf
|
ENV ODOO_RC /etc/odoo/odoo.conf
|
||||||
|
|
||||||
|
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
|
||||||
|
|
||||||
# Set default user when running the container
|
# Set default user when running the container
|
||||||
USER odoo
|
USER odoo
|
||||||
|
|
||||||
|
@ -12,11 +12,12 @@ set -e
|
|||||||
DB_ARGS=()
|
DB_ARGS=()
|
||||||
function check_config() {
|
function check_config() {
|
||||||
param="$1"
|
param="$1"
|
||||||
value="$2"
|
value="$2"
|
||||||
if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
||||||
DB_ARGS+=("--${param}")
|
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
|
||||||
DB_ARGS+=("${value}")
|
fi;
|
||||||
fi;
|
DB_ARGS+=("--${param}")
|
||||||
|
DB_ARGS+=("${value}")
|
||||||
}
|
}
|
||||||
check_config "db_host" "$HOST"
|
check_config "db_host" "$HOST"
|
||||||
check_config "db_port" "$PORT"
|
check_config "db_port" "$PORT"
|
||||||
@ -29,10 +30,12 @@ case "$1" in
|
|||||||
if [[ "$1" == "scaffold" ]] ; then
|
if [[ "$1" == "scaffold" ]] ; then
|
||||||
exec odoo "$@"
|
exec odoo "$@"
|
||||||
else
|
else
|
||||||
|
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||||
exec odoo "$@" "${DB_ARGS[@]}"
|
exec odoo "$@" "${DB_ARGS[@]}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
|
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||||
exec odoo "$@" "${DB_ARGS[@]}"
|
exec odoo "$@" "${DB_ARGS[@]}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
32
11.0/wait-for-psql.py
Executable file
32
11.0/wait-for-psql.py
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
|
import psycopg2
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
arg_parser = argparse.ArgumentParser()
|
||||||
|
arg_parser.add_argument('--db_host', required=True)
|
||||||
|
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('--timeout', type=int, default=5)
|
||||||
|
|
||||||
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
while (time.time() - start_time) < args.timeout:
|
||||||
|
try:
|
||||||
|
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')
|
||||||
|
error = ''
|
||||||
|
break
|
||||||
|
except psycopg2.OperationalError as e:
|
||||||
|
error = e
|
||||||
|
else:
|
||||||
|
conn.close()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print("Database connection failure: %s" % error, file=sys.stderr)
|
||||||
|
sys.exit(1)
|
@ -1,42 +1,79 @@
|
|||||||
FROM debian:stretch
|
FROM debian:stretch-slim
|
||||||
MAINTAINER Odoo S.A. <info@odoo.com>
|
MAINTAINER Odoo S.A. <info@odoo.com>
|
||||||
|
|
||||||
# Generate locale C.UTF-8 for postgres and general locale data
|
# Generate locale C.UTF-8 for postgres and general locale data
|
||||||
ENV LANG C.UTF-8
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
|
# Use backports to avoid install some libs with pip
|
||||||
|
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
|
||||||
|
|
||||||
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
||||||
RUN set -x; \
|
RUN set -x; \
|
||||||
apt-get update \
|
apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
node-less \
|
dirmngr \
|
||||||
python3-pip \
|
fonts-noto-cjk \
|
||||||
python3-setuptools \
|
gnupg \
|
||||||
python3-renderpm \
|
|
||||||
libssl1.0-dev \
|
libssl1.0-dev \
|
||||||
xz-utils \
|
node-less \
|
||||||
|
python3-num2words \
|
||||||
|
python3-pip \
|
||||||
|
python3-phonenumbers \
|
||||||
|
python3-pyldap \
|
||||||
|
python3-qrcode \
|
||||||
|
python3-renderpm \
|
||||||
|
python3-setuptools \
|
||||||
|
python3-vobject \
|
||||||
python3-watchdog \
|
python3-watchdog \
|
||||||
&& curl -o wkhtmltox.tar.xz -SL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
|
python3-xlwt \
|
||||||
&& echo '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum -c - \
|
xz-utils \
|
||||||
&& tar xvf wkhtmltox.tar.xz \
|
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb \
|
||||||
&& cp wkhtmltox/lib/* /usr/local/lib/ \
|
&& echo '7e35a63f9db14f93ec7feeb0fce76b30c08f2057 wkhtmltox.deb' | sha1sum -c - \
|
||||||
&& cp wkhtmltox/bin/* /usr/local/bin/ \
|
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
|
||||||
&& cp -r wkhtmltox/share/man/man1 /usr/local/share/man/
|
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb
|
||||||
|
|
||||||
|
# install latest postgresql-client
|
||||||
|
RUN set -x; \
|
||||||
|
echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' > etc/apt/sources.list.d/pgdg.list \
|
||||||
|
&& export GNUPGHOME="$(mktemp -d)" \
|
||||||
|
&& repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
|
||||||
|
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
|
||||||
|
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
|
||||||
|
&& gpgconf --kill all \
|
||||||
|
&& rm -rf "$GNUPGHOME" \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y postgresql-client \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install rtlcss (on Debian stretch)
|
||||||
|
RUN set -x;\
|
||||||
|
echo "deb http://deb.nodesource.com/node_8.x stretch main" > /etc/apt/sources.list.d/nodesource.list \
|
||||||
|
&& export GNUPGHOME="$(mktemp -d)" \
|
||||||
|
&& repokey='9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280' \
|
||||||
|
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
|
||||||
|
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/nodejs.gpg.asc \
|
||||||
|
&& gpgconf --kill all \
|
||||||
|
&& rm -rf "$GNUPGHOME" \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y nodejs \
|
||||||
|
&& npm install -g rtlcss \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Odoo
|
# Install Odoo
|
||||||
ENV ODOO_VERSION 12.0
|
ENV ODOO_VERSION 12.0
|
||||||
ENV ODOO_RELEASE 20181109
|
ARG ODOO_RELEASE=20191106
|
||||||
|
ARG ODOO_SHA=8dd3d36bd371b1eb6fbeb9ff7b049c8aea84327c
|
||||||
RUN set -x; \
|
RUN set -x; \
|
||||||
curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
||||||
&& echo 'fcaa0f72ecc8a4fa5636948a8966f7584eab1fac odoo.deb' | sha1sum -c - \
|
&& echo "${ODOO_SHA} odoo.deb" | sha1sum -c - \
|
||||||
&& dpkg --force-depends -i odoo.deb \
|
&& dpkg --force-depends -i odoo.deb \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get -y install -f --no-install-recommends \
|
&& apt-get -y install -f --no-install-recommends \
|
||||||
&& rm -rf /var/lib/apt/lists/* odoo.deb
|
&& rm -rf /var/lib/apt/lists/* odoo.deb
|
||||||
|
|
||||||
# Copy entrypoint script and Odoo configuration file
|
# Copy entrypoint script and Odoo configuration file
|
||||||
RUN pip3 install num2words xlwt
|
|
||||||
COPY ./entrypoint.sh /
|
COPY ./entrypoint.sh /
|
||||||
COPY ./odoo.conf /etc/odoo/
|
COPY ./odoo.conf /etc/odoo/
|
||||||
RUN chown odoo /etc/odoo/odoo.conf
|
RUN chown odoo /etc/odoo/odoo.conf
|
||||||
@ -52,6 +89,8 @@ EXPOSE 8069 8071
|
|||||||
# Set the default config file
|
# Set the default config file
|
||||||
ENV ODOO_RC /etc/odoo/odoo.conf
|
ENV ODOO_RC /etc/odoo/odoo.conf
|
||||||
|
|
||||||
|
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
|
||||||
|
|
||||||
# Set default user when running the container
|
# Set default user when running the container
|
||||||
USER odoo
|
USER odoo
|
||||||
|
|
||||||
|
@ -13,10 +13,11 @@ DB_ARGS=()
|
|||||||
function check_config() {
|
function check_config() {
|
||||||
param="$1"
|
param="$1"
|
||||||
value="$2"
|
value="$2"
|
||||||
if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
||||||
DB_ARGS+=("--${param}")
|
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
|
||||||
DB_ARGS+=("${value}")
|
fi;
|
||||||
fi;
|
DB_ARGS+=("--${param}")
|
||||||
|
DB_ARGS+=("${value}")
|
||||||
}
|
}
|
||||||
check_config "db_host" "$HOST"
|
check_config "db_host" "$HOST"
|
||||||
check_config "db_port" "$PORT"
|
check_config "db_port" "$PORT"
|
||||||
@ -29,10 +30,12 @@ case "$1" in
|
|||||||
if [[ "$1" == "scaffold" ]] ; then
|
if [[ "$1" == "scaffold" ]] ; then
|
||||||
exec odoo "$@"
|
exec odoo "$@"
|
||||||
else
|
else
|
||||||
|
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||||
exec odoo "$@" "${DB_ARGS[@]}"
|
exec odoo "$@" "${DB_ARGS[@]}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
|
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||||
exec odoo "$@" "${DB_ARGS[@]}"
|
exec odoo "$@" "${DB_ARGS[@]}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
32
12.0/wait-for-psql.py
Executable file
32
12.0/wait-for-psql.py
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
|
import psycopg2
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
arg_parser = argparse.ArgumentParser()
|
||||||
|
arg_parser.add_argument('--db_host', required=True)
|
||||||
|
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('--timeout', type=int, default=5)
|
||||||
|
|
||||||
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
while (time.time() - start_time) < args.timeout:
|
||||||
|
try:
|
||||||
|
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')
|
||||||
|
error = ''
|
||||||
|
break
|
||||||
|
except psycopg2.OperationalError as e:
|
||||||
|
error = e
|
||||||
|
else:
|
||||||
|
conn.close()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print("Database connection failure: %s" % error, file=sys.stderr)
|
||||||
|
sys.exit(1)
|
86
13.0/Dockerfile
Normal file
86
13.0/Dockerfile
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
FROM debian:buster-slim
|
||||||
|
MAINTAINER Odoo S.A. <info@odoo.com>
|
||||||
|
|
||||||
|
# Generate locale C.UTF-8 for postgres and general locale data
|
||||||
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
|
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
||||||
|
RUN set -x; \
|
||||||
|
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-vobject \
|
||||||
|
python3-watchdog \
|
||||||
|
python3-xlwt \
|
||||||
|
xz-utils \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
# install latest postgresql-client
|
||||||
|
RUN set -x; \
|
||||||
|
echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > etc/apt/sources.list.d/pgdg.list \
|
||||||
|
&& export GNUPGHOME="$(mktemp -d)" \
|
||||||
|
&& repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
|
||||||
|
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
|
||||||
|
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
|
||||||
|
&& gpgconf --kill all \
|
||||||
|
&& rm -rf "$GNUPGHOME" \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y postgresql-client \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install rtlcss (on Debian buster)
|
||||||
|
RUN set -x; \
|
||||||
|
npm install -g rtlcss
|
||||||
|
|
||||||
|
# Install Odoo
|
||||||
|
ENV ODOO_VERSION 13.0
|
||||||
|
ARG ODOO_RELEASE=20191106
|
||||||
|
ARG ODOO_SHA=b13bec4d20dfe36f1baa923719e37ea6bbe18a7d
|
||||||
|
RUN set -x; \
|
||||||
|
curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
||||||
|
&& echo "${ODOO_SHA} odoo.deb" | sha1sum -c - \
|
||||||
|
&& dpkg --force-depends -i odoo.deb \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get -y install -f --no-install-recommends \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* odoo.deb
|
||||||
|
|
||||||
|
# Copy entrypoint script and Odoo configuration file
|
||||||
|
COPY ./entrypoint.sh /
|
||||||
|
COPY ./odoo.conf /etc/odoo/
|
||||||
|
RUN chown odoo /etc/odoo/odoo.conf
|
||||||
|
|
||||||
|
# Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
|
||||||
|
RUN mkdir -p /mnt/extra-addons \
|
||||||
|
&& chown -R odoo /mnt/extra-addons
|
||||||
|
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
|
||||||
|
|
||||||
|
# Expose Odoo services
|
||||||
|
EXPOSE 8069 8071
|
||||||
|
|
||||||
|
# Set the default config file
|
||||||
|
ENV ODOO_RC /etc/odoo/odoo.conf
|
||||||
|
|
||||||
|
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
|
||||||
|
|
||||||
|
# Set default user when running the container
|
||||||
|
USER odoo
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD ["odoo"]
|
@ -13,10 +13,11 @@ DB_ARGS=()
|
|||||||
function check_config() {
|
function check_config() {
|
||||||
param="$1"
|
param="$1"
|
||||||
value="$2"
|
value="$2"
|
||||||
if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
|
||||||
DB_ARGS+=("--${param}")
|
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
|
||||||
DB_ARGS+=("${value}")
|
fi;
|
||||||
fi;
|
DB_ARGS+=("--${param}")
|
||||||
|
DB_ARGS+=("${value}")
|
||||||
}
|
}
|
||||||
check_config "db_host" "$HOST"
|
check_config "db_host" "$HOST"
|
||||||
check_config "db_port" "$PORT"
|
check_config "db_port" "$PORT"
|
||||||
@ -29,10 +30,12 @@ case "$1" in
|
|||||||
if [[ "$1" == "scaffold" ]] ; then
|
if [[ "$1" == "scaffold" ]] ; then
|
||||||
exec odoo "$@"
|
exec odoo "$@"
|
||||||
else
|
else
|
||||||
|
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||||
exec odoo "$@" "${DB_ARGS[@]}"
|
exec odoo "$@" "${DB_ARGS[@]}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
|
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||||
exec odoo "$@" "${DB_ARGS[@]}"
|
exec odoo "$@" "${DB_ARGS[@]}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
@ -1,5 +1,5 @@
|
|||||||
[options]
|
[options]
|
||||||
addons_path = /mnt/extra-addons,/usr/lib/python2.7/dist-packages/odoo/addons
|
addons_path = /mnt/extra-addons
|
||||||
data_dir = /var/lib/odoo
|
data_dir = /var/lib/odoo
|
||||||
; admin_passwd = admin
|
; admin_passwd = admin
|
||||||
; csv_internal_sep = ,
|
; csv_internal_sep = ,
|
32
13.0/wait-for-psql.py
Executable file
32
13.0/wait-for-psql.py
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
|
import psycopg2
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
arg_parser = argparse.ArgumentParser()
|
||||||
|
arg_parser.add_argument('--db_host', required=True)
|
||||||
|
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('--timeout', type=int, default=5)
|
||||||
|
|
||||||
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
while (time.time() - start_time) < args.timeout:
|
||||||
|
try:
|
||||||
|
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')
|
||||||
|
error = ''
|
||||||
|
break
|
||||||
|
except psycopg2.OperationalError as e:
|
||||||
|
error = e
|
||||||
|
else:
|
||||||
|
conn.close()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print("Database connection failure: %s" % error, file=sys.stderr)
|
||||||
|
sys.exit(1)
|
Loading…
Reference in New Issue
Block a user