Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 238 additions & 0 deletions 8.0.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
FROM python:2.7-stretch AS base
# docker build . -t qubiq/doodba:8.0 -f ./8.0.Dockerfile
EXPOSE 8069 8072

ARG GEOIP_UPDATER_VERSION=4.1.5
ARG MQT=https://github.com/OCA/maintainer-quality-tools.git
ARG WKHTMLTOPDF_VERSION=0.12.5
ARG WKHTMLTOPDF_CHECKSUM='1140b0ab02aa6e17346af2f14ed0de807376de475ba90e1db3975f112fbd20bb'
ENV DB_FILTER=.* \
DEPTH_DEFAULT=1 \
DEPTH_MERGE=100 \
EMAIL=https://hub.docker.com/r/tecnativa/odoo \
GEOIP_ACCOUNT_ID="" \
GEOIP_LICENSE_KEY="" \
GIT_AUTHOR_NAME=docker-odoo \
INITIAL_LANG="" \
LC_ALL=C.UTF-8 \
LIST_DB=false \
NODE_PATH=/usr/local/lib/node_modules:/usr/lib/node_modules \
OPENERP_SERVER=/opt/odoo/auto/odoo.conf \
PATH="/home/odoo/.local/bin:$PATH" \
PIP_NO_CACHE_DIR=0 \
PTVSD_ARGS="--host 0.0.0.0 --port 6899 --wait --multiprocess" \
PTVSD_ENABLE=0 \
DEBUGPY_ARGS="--listen 0.0.0.0:6899 --wait-for-client" \
DEBUGPY_ENABLE=0 \
PUDB_RDB_HOST=0.0.0.0 \
PUDB_RDB_PORT=6899 \
PYTHONOPTIMIZE=1 \
UNACCENT=true \
WAIT_DB=true \
WDB_NO_BROWSER_AUTO_OPEN=True \
WDB_SOCKET_SERVER=wdb \
WDB_WEB_PORT=1984 \
WDB_WEB_SERVER=localhost

# Other requirements and recommendations to run Odoo
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
#RUN sed -Ei 's@(^deb http://deb.debian.org/debian jessie-updates main$)@#\1@' /etc/apt/sources.list \
RUN sed -i 's,http://deb.debian.org,http://archive.debian.org,g;s,http://security.debian.org,http://archive.debian.org,g;s,\(.*stretch-updates\),#\1,' /etc/apt/sources.list \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y --no-install-recommends \
python ruby-compass \
fontconfig libfreetype6 libxml2 libxslt1.1 libjpeg62-turbo zlib1g \
fonts-liberation \
#libfreetype6 liblcms2-2 libopenjpeg5 libtiff5 tk tcl libpq5 \ THIS LINE WAS COMMENTED. liboopenjpeg5 is missing
libpng-dev libpng16-16\
libfreetype6 liblcms2-2 libtiff5 tk tcl libpq5 \
libldap-2.4-2 libsasl2-2 libx11-6 libxext6 libxrender1 \
locales-all zlibc \
bzip2 ca-certificates curl gettext git nano \
openssh-client telnet xz-utils \
&& curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python /dev/stdin \
&& curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get install -yqq nodejs \
&& curl -SLo fonts-liberation2.deb http://ftp.debian.org/debian/pool/main/f/fonts-liberation2/fonts-liberation2_2.00.1-3_all.deb \
&& dpkg --install fonts-liberation2.deb \
&& curl -SLo wkhtmltox.deb https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox_${WKHTMLTOPDF_VERSION}-1.stretch_amd64.deb \
&& echo "${WKHTMLTOPDF_CHECKSUM} wkhtmltox.deb" | sha256sum -c - \
&& (dpkg --install wkhtmltox.deb || true) \
&& apt-get install -yqq --no-install-recommends --fix-broken \
&& rm fonts-liberation2.deb wkhtmltox.deb \
&& wkhtmltopdf --version \
&& curl --silent -L --output geoipupdate_${GEOIP_UPDATER_VERSION}_linux_amd64.deb https://github.com/maxmind/geoipupdate/releases/download/v${GEOIP_UPDATER_VERSION}/geoipupdate_${GEOIP_UPDATER_VERSION}_linux_amd64.deb \
&& dpkg -i geoipupdate_${GEOIP_UPDATER_VERSION}_linux_amd64.deb \
&& rm geoipupdate_${GEOIP_UPDATER_VERSION}_linux_amd64.deb \
&& rm -Rf /var/lib/apt/lists/*

# Special case to get latest PostgreSQL client in 250-postgres-client
# RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' >> /etc/apt/sources.list.d/postgresql.list \
# && curl -SL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \

# Special case to get latest Less and PhantomJS
RUN ln -s /usr/bin/nodejs /usr/local/bin/node \
&& npm install -g less@2 less-plugin-clean-css@1 phantomjs-prebuilt@2 \
&& rm -Rf ~/.npm /tmp/*

# Special case to get bootstrap-sass, required by Odoo for Sass assets
RUN gem install --no-rdoc --no-ri --no-update-sources autoprefixer-rails --version '<9.8.6' \
&& gem install --no-rdoc --no-ri --no-update-sources bootstrap-sass --version '<3.4' \
&& rm -Rf ~/.gem /var/lib/gems/*/cache/

# Other facilities
WORKDIR /opt/odoo
RUN pip install \
click-odoo-contrib \
git-aggregator \
plumbum \
ptvsd \
debugpy \
pudb \
virtualenv \
wdb \
simplejson \
geoip2 \
&& sync
COPY bin-deprecated/* bin/* /usr/local/bin/
COPY lib/doodbalib /usr/local/lib/python2.7/site-packages/doodbalib
RUN ln -s /usr/local/lib/python2.7/site-packages/doodbalib \
/usr/local/lib/python2.7/site-packages/odoobaselib
COPY build.d common/build.d
COPY conf.d common/conf.d
COPY entrypoint.d common/entrypoint.d
RUN mkdir -p auto/addons auto/geoip custom/src/private \
&& ln /usr/local/bin/direxec common/entrypoint \
&& ln /usr/local/bin/direxec common/build \
&& chmod -R a+rx common/entrypoint* common/build* /usr/local/bin \
&& chmod -R a+rX /usr/local/lib/python2.7/site-packages/doodbalib \
&& cp -a /etc/GeoIP.conf /etc/GeoIP.conf.orig \
&& mv /etc/GeoIP.conf /opt/odoo/auto/geoip/GeoIP.conf \
&& ln -s /opt/odoo/auto/geoip/GeoIP.conf /etc/GeoIP.conf \
&& sed -i 's/.*DatabaseDirectory .*$/DatabaseDirectory \/opt\/odoo\/auto\/geoip\//g' /opt/odoo/auto/geoip/GeoIP.conf \
&& sync

#Doodba-QA dependencies in a separate virtualenv
COPY qa /qa
RUN virtualenv --system-site-packages /qa/venv \
&& . /qa/venv/bin/activate \
&& pip install --no-cache-dir \
click \
coverage \
flake8 \
git+https://github.com/OCA/pylint-odoo.git@refs/pull/329/head \
six \
&& npm install --loglevel error --prefix /qa 'eslint@<6' \
&& deactivate \
&& mkdir -p /qa/artifacts \
&& git clone --depth 1 $MQT /qa/mqt

# Execute installation script by Odoo version
# This is at the end to benefit from cache at build time
# https://docs.docker.com/engine/reference/builder/#/impact-on-build-caching

ARG ODOO_SOURCE=OCA/OCB
ARG ODOO_VERSION=8.0
ENV ODOO_VERSION="$ODOO_VERSION"
#RUN install.sh
RUN debs="libldap2-dev libsasl2-dev" \
&& apt-get update \
&& apt-get install -yqq --no-install-recommends $debs \
&& pip install \
-r https://raw.githubusercontent.com/odoo/odoo/8.0/requirements.txt \
# && (python3 -m compileall -q /usr/local/lib/python3.5/ || true) \
# && apt-get purge -yqq $debs \
&& rm -Rf /var/lib/apt/lists/* /tmp/*


RUN pip install pg_activity

# Metadata
ARG VCS_REF
ARG BUILD_DATE
ARG VERSION
LABEL org.label-schema.schema-version="$VERSION" \
org.label-schema.vendor=Tecnativa \
org.label-schema.license=Apache-2.0 \
org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.vcs-ref="$VCS_REF" \
org.label-schema.vcs-url="https://github.com/Tecnativa/doodba"

# Onbuild version, with all the magic
FROM base AS onbuild

# Subimage triggers
ONBUILD USER root
ONBUILD ENTRYPOINT ["/opt/odoo/common/entrypoint"]
ONBUILD CMD ["/usr/local/bin/odoo"]
ONBUILD ARG AGGREGATE=true
ONBUILD ARG DEFAULT_REPO_PATTERN="https://github.com/OCA/{}.git"
ONBUILD ARG DEFAULT_REPO_PATTERN_ODOO="https://github.com/OCA/OCB.git"
ONBUILD ARG DEPTH_DEFAULT=1
ONBUILD ARG DEPTH_MERGE=100
ONBUILD ARG CLEAN=true
ONBUILD ARG COMPILE=true
ONBUILD ARG FONT_MONO="Liberation Mono"
ONBUILD ARG FONT_SANS="Liberation Sans"
ONBUILD ARG FONT_SERIF="Liberation Serif"
ONBUILD ARG PIP_INSTALL_ODOO=true
ONBUILD ARG ADMIN_PASSWORD=admin
ONBUILD ARG SMTP_SERVER=smtp
ONBUILD ARG SMTP_PORT=25
ONBUILD ARG SMTP_USER=false
ONBUILD ARG SMTP_PASSWORD=false
ONBUILD ARG SMTP_SSL=false
ONBUILD ARG EMAIL_FROM=""
ONBUILD ARG PROXY_MODE=false
ONBUILD ARG WITHOUT_DEMO=all
ONBUILD ARG PGUSER=odoo
ONBUILD ARG PGPASSWORD=odoopassword
ONBUILD ARG PGHOST=db
ONBUILD ARG PGPORT=5432
ONBUILD ARG PGDATABASE=prod
# Config variables
ONBUILD ENV ADMIN_PASSWORD="$ADMIN_PASSWORD" \
DEFAULT_REPO_PATTERN="$DEFAULT_REPO_PATTERN" \
DEFAULT_REPO_PATTERN_ODOO="$DEFAULT_REPO_PATTERN_ODOO" \
UNACCENT="$UNACCENT" \
PGUSER="$PGUSER" \
PGPASSWORD="$PGPASSWORD" \
PGHOST="$PGHOST" \
PGPORT=$PGPORT \
PGDATABASE="$PGDATABASE" \
PROXY_MODE="$PROXY_MODE" \
SMTP_SERVER="$SMTP_SERVER" \
SMTP_PORT=$SMTP_PORT \
SMTP_USER="$SMTP_USER" \
SMTP_PASSWORD="$SMTP_PASSWORD" \
SMTP_SSL="$SMTP_SSL" \
EMAIL_FROM="$EMAIL_FROM" \
WITHOUT_DEMO="$WITHOUT_DEMO"
ONBUILD ARG LOCAL_CUSTOM_DIR=./custom
ONBUILD COPY $LOCAL_CUSTOM_DIR /opt/odoo/custom

# Enable setting custom uids for odoo user during build of scaffolds
ONBUILD ARG UID=1000
ONBUILD ARG GID=1000

# Enable Odoo user and filestore
ONBUILD RUN groupadd -g $GID odoo -o \
&& useradd -l -md /home/odoo -s /bin/false -u $UID -g $GID odoo \
&& mkdir -p /var/lib/odoo \
&& chown -R odoo:odoo /var/lib/odoo /qa/artifacts\
&& chmod a=rwX /qa/artifacts \
&& sync

# https://docs.python.org/2.7/library/logging.html#levels
ONBUILD ARG LOG_LEVEL=INFO
ONBUILD RUN mkdir -p /opt/odoo/custom/ssh \
&& ln -s /opt/odoo/custom/ssh ~root/.ssh \
&& chmod -R u=rwX,go= /opt/odoo/custom/ssh \
&& sync
ONBUILD ARG DB_VERSION=latest
ONBUILD RUN /opt/odoo/common/build && sync
ONBUILD VOLUME ["/var/lib/odoo"]
ONBUILD USER odoo
# HACK Special case for Werkzeug
ONBUILD RUN pip install --user Werkzeug==0.14.1
18 changes: 18 additions & 0 deletions build.d/700-odoo-install
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@ log INFO Installing Odoo from $src
# For development you could want to avoid installing Odoo to speed up build
if [ "$PIP_INSTALL_ODOO" == true ]; then
args="--no-cache-dir"
# Odoo <= v8 dependencies could crash at install, so we don't use them
if [ "$ODOO_VERSION" == "7.0" -o "$ODOO_VERSION" == "8.0" ]; then
args="$args --no-deps"
fi
pip install $args --editable $src

# Make versions 7.0 to 9.0 have an `odoo` executable
if [ "$ODOO_VERSION" == "7.0" ]; then
ln -s /usr/local/bin/openerp-server $dst
elif [ "$ODOO_VERSION" == "8.0" -o "$ODOO_VERSION" == "9.0" ]; then
ln -s $dst.py $dst
fi
else
log WARNING Blindly symlinking odoo executable
bin=$src/odoo-bin
# Cannot check for scripts existence and link all: they probably do not
# exist yet at build time! Just check Odoo version and act properly.
if [ "$ODOO_VERSION" == "7.0" ]; then
bin=$src/openerp-server
ln -s /opt/odoo/custom/src/odoo/openerp-server /usr/local/bin/
elif [ "$ODOO_VERSION" == "8.0" -o "$ODOO_VERSION" == "9.0" ]; then
bin=$src/odoo.py
ln -s /opt/odoo/custom/src/odoo/openerp-{gevent,server} /usr/local/bin/
fi
ln -s $bin $dst
fi