[IMP] remove unneeded gosu from the Dockerfile

This commit is contained in:
Samus CTO 2015-02-27 14:56:57 +01:00
parent 22de85b69e
commit 5829e2968d
2 changed files with 9 additions and 11 deletions

View File

@ -17,14 +17,6 @@ RUN apt-get update \
&& apt-get -y install -f \ && apt-get -y install -f \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb && 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 # Install Odoo
ENV ODOO_VERSION 8.0 ENV ODOO_VERSION 8.0
ENV ODOO_RELEASE 20141231 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 # Run script and Odoo configuration file
COPY ./run.sh / COPY ./run.sh /
COPY ./openerp-server.conf /etc/odoo/ COPY ./openerp-server.conf /etc/odoo/
RUN chown odoo /etc/odoo/openerp-server.conf
# Mount /var/lib/odoo to allow restoring filestore # Mount /var/lib/odoo to allow restoring filestore
VOLUME ["/var/lib/odoo"] VOLUME ["/var/lib/odoo"]
# Set default user when running the container
USER odoo
ENTRYPOINT ["/run.sh"] ENTRYPOINT ["/run.sh"]

View File

@ -7,12 +7,14 @@ CONFIG_FILE=/etc/odoo/openerp-server.conf
# sets a configuration variable in openerp-server.conf # sets a configuration variable in openerp-server.conf
# $1: key, $2: value # $1: key, $2: value
function set_config { function set_config {
temp=`mktemp`
if grep -q "^$1.*" $CONFIG_FILE if grep -q "^$1.*" $CONFIG_FILE
then then
sed -i "s/^$1.*$/$1 = $2/" $CONFIG_FILE sed "s/^$1.*$/$1 = $2/" $CONFIG_FILE > $temp
else else
sed -i "$ a$1 = $2" $CONFIG_FILE sed "$ a$1 = $2" $CONFIG_FILE > $temp
fi fi
cat $temp > $CONFIG_FILE
} }
# set odoo data directory and database host, port, user and password # 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 set_config "db_password" $DB_ENV_POSTGRES_PASSWORD
# start Odoo # start Odoo
exec gosu odoo /usr/bin/openerp-server --config $CONFIG_FILE "$@" exec /usr/bin/openerp-server --config $CONFIG_FILE "$@"