Add support for gosu to allow for root access.

Additionally deal with case of user specifiying openerp-server as part
of the command line to run.
This commit is contained in:
Colin Newell 2015-07-30 12:31:21 +01:00
parent 44e600fcfd
commit 6547b0d188
2 changed files with 21 additions and 12 deletions

View File

@ -1,6 +1,15 @@
FROM debian:jessie
MAINTAINER Odoo S.A. <info@odoo.com>
# grab gosu for easy step-down from root
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
&& 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 some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN set -x; \
apt-get update \
@ -60,8 +69,5 @@ EXPOSE 8069 8071
# Set the default config file
ENV OPENERP_SERVER /etc/odoo/openerp-server.conf
# Set default user when running the container
USER odoo
ENTRYPOINT ["/entrypoint.sh"]
CMD ["openerp-server"]

View File

@ -10,15 +10,18 @@ set -e
export PGHOST PGPORT PGUSER PGPASSWORD
case "$1" in
--)
shift
exec openerp-server "$@"
;;
-*)
exec openerp-server "$@"
;;
*)
exec "$@"
--)
shift
exec gosu odoo openerp-server "$@"
;;
-*)
exec gosu odoo openerp-server "$@"
;;
openerp-server)
exec gosu odoo "$@"
;;
*)
exec "$@"
esac
exit 1