From 5829e2968dfdd843b844b7b6941f3e544a63aeb0 Mon Sep 17 00:00:00 2001 From: Samus CTO Date: Fri, 27 Feb 2015 14:56:57 +0100 Subject: [PATCH] [IMP] remove unneeded gosu from the Dockerfile --- 8.0/Dockerfile | 12 ++++-------- 8.0/run.sh | 8 +++++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index ce116e2..4c56c9e 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 @@ -41,8 +33,12 @@ RUN apt-key adv --keyserver pgp.mit.edu --recv-keys 0xdef2a2198183cbb5 \ # Run script and Odoo configuration file COPY ./run.sh / COPY ./openerp-server.conf /etc/odoo/ +RUN chown odoo /etc/odoo/openerp-server.conf # Mount /var/lib/odoo to allow restoring filestore VOLUME ["/var/lib/odoo"] +# Set default user when running the container +USER odoo + ENTRYPOINT ["/run.sh"] diff --git a/8.0/run.sh b/8.0/run.sh index 5884e02..930c18e 100755 --- a/8.0/run.sh +++ b/8.0/run.sh @@ -7,12 +7,14 @@ CONFIG_FILE=/etc/odoo/openerp-server.conf # sets a configuration variable in openerp-server.conf # $1: key, $2: value function set_config { + temp=`mktemp` if grep -q "^$1.*" $CONFIG_FILE then - sed -i "s/^$1.*$/$1 = $2/" $CONFIG_FILE + sed "s/^$1.*$/$1 = $2/" $CONFIG_FILE > $temp else - sed -i "$ a$1 = $2" $CONFIG_FILE + sed "$ a$1 = $2" $CONFIG_FILE > $temp fi + cat $temp > $CONFIG_FILE } # set odoo data directory and database host, port, user and password @@ -23,4 +25,4 @@ 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 "$@" +exec /usr/bin/openerp-server --config $CONFIG_FILE "$@"