I'm trying to run odoo as SAAS service using docker .I created Odoo image successfully but when i run the image to build a container it is stopped on starting odoo stage , here is sample output of the command :
$ docker container run -it odoo:1.2
Entering The entrypoint.sh
Setting up Pip3 dependency if any
Could not open requirements file: [Errno 2] No such file or directory: '/mnt/extra-addons/requirements.txt'
Call sent for starting Odoo
Starting Odoo
Here is my Dockerfile :
FROM ubuntu:18.04
LABEL maintainer="me"
#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 \
dirmngr \
node-less \
python3-gevent \
python-ldap \
python3-pip \
python3-setuptools \
gnupg \
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb \
&& apt install ./wkhtmltox.deb -y \
&& apt-get -y install -f --no-install-recommends \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb \
&& pip3 install psycogreen==1.0
#install latest postgresql-client
RUN set -x; \
echo 'deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main' > etc/apt/sources.list.d/pgdg.list \
&& export GNUPGHOME="$(mktemp -d)" \
&& repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
&& gpgconf --kill all \
&& rm -rf "$GNUPGHOME" \
&& apt-get update \
&& apt-get install -y postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& apt update && apt-get install -y git libpq-dev libxml2-dev libxslt-dev libffi-dev gcc python3-dev libsasl2-dev python-dev libldap2-dev libssl-dev \
&& apt update && apt-get install -y npm \
&& npm install -g less less-plugin-clean-css rtlcss \
&& apt-get install -y node-less
#Create /etc/odoo directory
RUN set -x; \
mkdir /etc/odoo \
#Install Odoo
ENV ODOO_VERSION 12.0
#This binds to service file.So, take care
ARG ODOO_USER=odoo
ARG ODOO_USER_UID=888
ARG ODOO_USER_GID=888
RUN set -x; \
groupadd -r -g ${ODOO_USER_GID} ${ODOO_USER} \
&& adduser --system --home=/opt/${ODOO_USER} ${ODOO_USER} --uid ${ODOO_USER_UID} --gid ${ODOO_USER_GID} \
&& su - ${ODOO_USER} -s /bin/bash -c "git clone https://MY-REPO.git" \
&& mkdir /var/log/odoo \
&& chown ${ODOO_USER}:root /var/log/odoo
COPY ./odoo-server.conf /etc/odoo/
RUN set -x; \
chown -R ${ODOO_USER} /etc/odoo/ \
&& chmod 640 /etc/odoo/odoo-server.conf \
&& pip3 install wheel phonenumbers
#Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
Run set -x; \
mkdir -p /mnt/extra-addons \
&& chown -R odoo /mnt/extra-addons \
&& pip3 install -r /opt/odoo/odoo/requirements.txt
COPY ./entrypoint.sh /
COPY ./run_odoo.sh /
#VOLUME ["/mnt/extra-addons","/opt/data_dir"]
# Expose Odoo services
EXPOSE 8069 8071 8072
# Set default user when running the container
USER ${ODOO_USER}
ENTRYPOINT ["/entrypoint.sh"]
I used entrypoint file with the following instructions :
#!/bin/bash
#set -e
echo "Entering The entrypoint.sh"
echo "Setting up Pip3 dependency if any"
pip3 install -r /mnt/extra-addons/requirements.txt
echo "Call sent for starting Odoo"
while true; do /bin/bash run_odoo.sh; echo "Odoo Exited"; done
echo "Start the Exta bash"
exec /bin/bash
Also, run_odoo.sh file commands :
#!/bin/sh
echo "Starting Odoo"
exec /opt/odoo/odoo/odoo-bin -c /etc/odoo/odoo-server.conf
I'm stuck in this point and i don't know why the container is not running if any one can help i'll appreciate . Note : I'm new to docker. Regards