diff --git a/8.0/Dockerfile b/8.0/Dockerfile index bb67313..cce97eb 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -17,14 +17,6 @@ RUN apt-get update \ && apt-get -y install -f \ && rm -rf /var/lib/apt/lists/* wkhtmltox.deb -# Grab gosu for easy step-down from root -RUN gpg --keyserver pgp.mit.edu --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ - && gpg --verify /usr/local/bin/gosu.asc \ - && rm /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu - # Install Odoo ENV ODOO_VERSION 8.0 ENV ODOO_RELEASE 20141231 @@ -36,9 +28,14 @@ RUN curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odo # Run script and Odoo configuration file COPY ./run.sh / -COPY ./openerp-server.conf /etc/odoo/ # Mount /var/lib/odoo to allow restoring filestore VOLUME ["/var/lib/odoo"] -CMD ["/run.sh"] +# Expose Odoo service +EXPOSE 8069 + +# Set default user when running the container +USER odoo + +ENTRYPOINT ["/run.sh"] diff --git a/8.0/openerp-server.conf b/8.0/openerp-server.conf deleted file mode 100644 index ccc8caf..0000000 --- a/8.0/openerp-server.conf +++ /dev/null @@ -1,42 +0,0 @@ -[options] -addons_path = /usr/lib/python2.7/dist-packages/openerp/addons -db_host = False -db_password = False -db_port = False -db_user = odoo -; admin_passwd = admin -; auto_reload = False -; csv_internal_sep = , -; data_dir = False -; 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 diff --git a/8.0/run.sh b/8.0/run.sh index f1dd6a0..41dc889 100755 --- a/8.0/run.sh +++ b/8.0/run.sh @@ -1,24 +1,12 @@ #!/bin/bash -CONFIG_FILE=/etc/odoo/openerp-server.conf +# set odoo database host, port, user and password +export PGHOST=$DB_PORT_5432_TCP_ADDR +export PGPORT=$DB_PORT_5432_TCP_PORT +export PGUSER=$DB_ENV_POSTGRES_USER +export PGPASSWORD=$DB_ENV_POSTGRES_PASSWORD -# sets a configuration variable in openerp-server.conf -# $1: key, $2: value -function set_config { - if grep -q "^$1.*" $CONFIG_FILE - then - sed -i "s/^$1.*$/$1 = $2/" $CONFIG_FILE - else - sed -i "$ a$1 = $2" $CONFIG_FILE - fi -} +[ "$1" != "--" ] && exec "$@" -# set odoo data directory and database host, port, user and password -set_config "data_dir" "\/var\/lib\/odoo" -set_config "db_host" $DB_PORT_5432_TCP_ADDR -set_config "db_port" $DB_PORT_5432_TCP_PORT -set_config "db_user" $DB_ENV_POSTGRES_USER -set_config "db_password" $DB_ENV_POSTGRES_PASSWORD - -# start Odoo -exec gosu odoo /usr/bin/openerp-server --config $CONFIG_FILE +shift +exec /usr/bin/openerp-server --config=/etc/odoo/openerp-server.conf "$@"