FROM oraclelinux:6
LABEL maintainer="Yaltik - Fabien Bourgeois <fabien@yaltik.com>"

# OpenERP dependencies from CentOS
# RUN yum update -y
RUN yum install -y python-devel python-lxml python-psycopg2 python-mako \
python-setuptools wget git gcc tar && \
  yum clean all
# RUN yum groupinstall -y "Development Tools"

# PIP
# RUN easy_install setuptools
# RUN wget https://bootstrap.pypa.io/get-pip.py
# RUN python get-pip.py
# RUN pip install --upgrade pip setuptools wheel

# Create odoo user
RUN useradd odoo -md /opt/odoo
WORKDIR /opt/odoo
USER odoo
RUN mkdir -p /opt/odoo/log/openerp-web

# Web Client
RUN wget -q https://launchpad.net/openobject-client-web/6.0/6.0.4/+download/openerp-web-6.0.4.tar.gz && \
      tar xzf openerp-web-6.0.4.tar.gz && rm openerp-web-6.0.4.tar.gz && \
      mv openerp-web-6.0.4 openerp-web

# COPY requirementsweb60.txt requirements.txt
# Replace >= to exact versions on scripts
# Babel specific : no version available prior to 0.9.6
RUN sed -i -- 's/>=/==/g' openerp-web/setup.py && \
      sed -i -- 's/>=/==/g' openerp-web/lib/populate.sh && \
      sed -i -- 's/0.9.4/0.9.6/g' openerp-web/setup.py && \
      sed -i -- 's/0.9.4/0.9.6/g' openerp-web/lib/populate.sh

USER root
# RUN pip install -r requirements.txt

WORKDIR /opt/odoo/openerp-web/lib
RUN bash populate.sh

WORKDIR /opt/odoo/openerp-web
# Needed in 2022, every dependency
RUN wget -q https://files.pythonhosted.org/packages/38/b2/7e8d6c97fb684ba6b131e9173a09ff2f0341f85a7376038df7318cd3ed0e/CherryPy-3.1.2.tar.gz && \
      easy_install CherryPy-3.1.2.tar.gz && \
      wget -q https://files.pythonhosted.org/packages/65/b7/371df6136a2dceab36c1bd3947211b112f78225c4d0a6a3e20eb008cbc16/Mako-0.2.4.tar.gz && \
      easy_install Mako-0.2.4.tar.gz && \
      wget -q https://files.pythonhosted.org/packages/5a/9d/2ed1579c088a6c5953bf31b9929cb0b2421252bd0f7fceed6e9e8f21b007/Babel-0.9.6-py2.6.egg && \
      easy_install Babel-0.9.6-py2.6.egg && \
      wget -q https://files.pythonhosted.org/packages/b9/f7/b545bc8d7dfc4b3cbd74c60c6af816110bcfecc02f7e36e7d62dd8bf9d1a/FormEncode-1.2.2.tar.gz && \
      easy_install FormEncode-1.2.2.tar.gz && \
      wget -q https://files.pythonhosted.org/packages/da/8c/a45815b421e49acad7d3d0db4ba65ba1e5cfa02a30c794fe55954106cb0b/simplejson-2.0.9.tar.gz && \
      easy_install simplejson-2.0.9.tar.gz && \
      wget -q https://files.pythonhosted.org/packages/27/50/0a3e33ba83cebfef5e14fd52c1d6f053870618b6e15cf3e99fd5b893b2c7/python-dateutil-1.4.1.tar.gz && \
      easy_install python-dateutil-1.4.1.tar.gz && \
      wget -q https://files.pythonhosted.org/packages/ab/ff/9c14978cffcc911ea84ba0ceacedcad78e7722fdafbcde8ce52ce04fa0db/pytz-2009j.tar.gz && \
      easy_install pytz-2009j.tar.gz && \
      python setup.py install

USER odoo
WORKDIR /opt/odoo
COPY genconfweb60.sh genconf.sh
COPY launchweb60.sh launch.sh

CMD ["bash", "launch.sh"]
