diff --git a/12.0/Dockerfile b/12.0/Dockerfile new file mode 100644 index 0000000..39e1ef2 --- /dev/null +++ b/12.0/Dockerfile @@ -0,0 +1,59 @@ +FROM debian:stretch +MAINTAINER Odoo S.A. + +# 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 \ + node-less \ + python3-pip \ + python3-setuptools \ + python3-renderpm \ + libssl1.0-dev \ + xz-utils \ + 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 \ + && echo '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum -c - \ + && tar xvf wkhtmltox.tar.xz \ + && cp wkhtmltox/lib/* /usr/local/lib/ \ + && cp wkhtmltox/bin/* /usr/local/bin/ \ + && cp -r wkhtmltox/share/man/man1 /usr/local/share/man/ + +# Install Odoo +ENV ODOO_VERSION 12.0 +ENV ODOO_RELEASE 20181004 +RUN set -x; \ + curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \ + && echo '3c8718416df355bc823a0c1cb4af6b8141183a3b 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 +RUN pip3 install num2words xlwt +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"] diff --git a/12.0/entrypoint.sh b/12.0/entrypoint.sh new file mode 100755 index 0000000..4f0ef59 --- /dev/null +++ b/12.0/entrypoint.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +# set the postgres database host, port, user and password according to the environment +# and pass them as arguments to the odoo process if not present in the config file +: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}} +: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}} +: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}} +: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}} + +DB_ARGS=() +function check_config() { + param="$1" + value="$2" + if ! grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then + DB_ARGS+=("--${param}") + DB_ARGS+=("${value}") + fi; +} +check_config "db_host" "$HOST" +check_config "db_port" "$PORT" +check_config "db_user" "$USER" +check_config "db_password" "$PASSWORD" + +case "$1" in + -- | odoo) + shift + if [[ "$1" == "scaffold" ]] ; then + exec odoo "$@" + else + exec odoo "$@" "${DB_ARGS[@]}" + fi + ;; + -*) + exec odoo "$@" "${DB_ARGS[@]}" + ;; + *) + exec "$@" +esac + +exit 1 diff --git a/12.0/odoo.conf b/12.0/odoo.conf new file mode 100644 index 0000000..28f70c1 --- /dev/null +++ b/12.0/odoo.conf @@ -0,0 +1,37 @@ +[options] +addons_path = /mnt/extra-addons +data_dir = /var/lib/odoo +; admin_passwd = admin +; csv_internal_sep = , +; db_maxconn = 64 +; db_name = False +; db_template = template1 +; dbfilter = .* +; debug_mode = False +; email_from = False +; limit_memory_hard = 2684354560 +; limit_memory_soft = 2147483648 +; limit_request = 8192 +; limit_time_cpu = 60 +; limit_time_real = 120 +; list_db = True +; log_db = False +; log_handler = [':INFO'] +; log_level = info +; logfile = None +; longpolling_port = 8072 +; max_cron_threads = 2 +; osv_memory_age_limit = 1.0 +; osv_memory_count_limit = False +; smtp_password = False +; smtp_port = 25 +; smtp_server = localhost +; smtp_ssl = False +; smtp_user = False +; workers = 0 +; xmlrpc = True +; xmlrpc_interface = +; xmlrpc_port = 8069 +; xmlrpcs = True +; xmlrpcs_interface = +; xmlrpcs_port = 8071