Skip to content

Commit

Permalink
Merge pull request #76 from seb-elico/10.0-minor-bugfixes
Browse files Browse the repository at this point in the history
Re-do #72
  • Loading branch information
seb-elico authored Aug 28, 2017
2 parents 7d815fd + a81b73f commit 0073a93
Show file tree
Hide file tree
Showing 10 changed files with 888 additions and 287 deletions.
68 changes: 39 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
FROM ubuntu:14.04
MAINTAINER Elico Corp <[email protected]>
MAINTAINER Elico Corp <[email protected]>

# Define build constants
ENV ODOO_VERSION=10.0 \
PG_VERSION=9.5 \
BINARY_NAME=odoo-bin

# Set timezone to UTC
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# generate locales
RUN locale-gen en_US.UTF-8 && update-locale
Expand All @@ -11,25 +19,24 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com \
--recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8

# Add PostgreSQL's repository. It contains the most recent stable release
# of PostgreSQL, ``9.5``.
# install dependencies as distrib packages when system bindings are required
# some of them extend the basic odoo requirements for a better "apps" compatibility
# most dependencies are distributed as wheel packages at the next step
# of PostgreSQL.
# Install dependencies as distrib packages when system bindings are required.
# Some of them extend the basic Odoo requirements for a better "apps"
# compatibility.
# Most dependencies are distributed as PIP packages at the next step
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > \
/etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get -yq install \
adduser \
ghostscript \
postgresql-client-9.5 \
postgresql-client-$PG_VERSION \
python \
python-pip \
python-imaging \
python-pychart python-libxslt1 xfonts-base xfonts-75dpi \
libxrender1 libxext6 fontconfig \
python-zsi \
python-lasso \
libzmq3 \
# libpq-dev is needed to install pg_config which is required by psycopg2
libpq-dev \
# These libraries are needed to install the pip modules
Expand All @@ -40,10 +47,6 @@ RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > \
libldap2-dev \
libsasl2-dev \
libssl-dev \
# Librairies required for LESS
node-less \
nodejs \
npm \
# This library is necessary to upgrade PIL/pillow module
libjpeg8-dev \
# Git is required to clone Odoo OCB project
Expand All @@ -53,10 +56,6 @@ RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > \
ADD sources/pip-req.txt /opt/sources/pip-req.txt
RUN pip install -r /opt/sources/pip-req.txt

# Install LESS
RUN npm install -g less less-plugin-clean-css && \
ln -s /usr/bin/nodejs /usr/bin/node

# must unzip this package to make it visible as an odoo external dependency
RUN easy_install -UZ py3o.template==0.9.11
RUN easy_install -UZ py3o.types==0.1.1
Expand All @@ -68,17 +67,14 @@ ADD https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmlto
/opt/sources/wkhtmltox.deb
RUN dpkg -i /opt/sources/wkhtmltox.deb

# Script to map the Odoo user with the host user (see FIXME inside)
ADD sources/target_user.sh /opt/sources/target_user.sh

# Startup script for custom setup
ADD sources/startup.sh /opt/scripts/startup.sh

# create the odoo user
RUN adduser --home=/opt/odoo --disabled-password --gecos "" --shell=/bin/bash odoo
# Create the odoo user
RUN useradd --create-home --home-dir /opt/odoo --no-log-init odoo

# Switch to user odoo to create the folders mapped with volumes, else the corresponding
# folders will be created by root on the host
# Switch to user odoo to create the folders mapped with volumes, else the
# corresponding folders will be created by root on the host
USER odoo

# If the folders are created with "RUN mkdir" command, they will belong to root
Expand All @@ -88,17 +84,17 @@ RUN /bin/bash -c "mkdir -p /opt/odoo/var/{run,log,egg-cache}"

# Add Odoo OCB sources and remove .git folder in order to reduce image size
WORKDIR /opt/odoo/sources
RUN git clone https://github.com/OCA/OCB.git -b 10.0 odoo && \
RUN git clone https://github.com/OCA/OCB.git -b $ODOO_VERSION odoo && \
rm -rf odoo/.git

ADD sources/odoo.conf /opt/odoo/etc/odoo.conf
ADD auto_addons /opt/odoo/auto_addons

User 0

# Provide read/write access to group (for host user mapping). For some reason, the
# files added in a volume (e.g. odoo.conf) belong to root. This command imperatively
# needs to run before creating the volumes.
# Provide read/write access to odoo group (for host user mapping). This command
# must run before creating the volumes since they become readonly until the
# container is started.
RUN chmod -R 775 /opt/odoo && chown -R odoo:odoo /opt/odoo

VOLUME [ \
Expand All @@ -110,10 +106,24 @@ VOLUME [ \
"/opt/scripts" \
]

# Use README for the help & man commands
ADD README.md /usr/share/man/man.txt
# Remove anchors and links to anchors to improve readability
RUN sed -i '/^<a name="/ d' /usr/share/man/man.txt
RUN sed -i -e 's/\[\^\]\[toc\]//g' /usr/share/man/man.txt
RUN sed -i -e 's/\(\[.*\]\)(#.*)/\1/g' /usr/share/man/man.txt
# For help command, only keep the "Usage" section
RUN from=$( awk '/^## Usage/{ print NR; exit }' /usr/share/man/man.txt ) && \
from=$(expr $from + 1) && \
to=$( awk '/^ \$ docker-compose up/{ print NR; exit }' /usr/share/man/man.txt ) && \
head -n $to /usr/share/man/man.txt | \
tail -n +$from | \
tee /usr/share/man/help.txt > /dev/null

# Set the default entrypoint (non overridable) to run when starting the container
ADD bin /app/bin/
ENTRYPOINT ["/app/bin/boot"]
CMD ["help"]
ENTRYPOINT [ "/app/bin/boot" ]
CMD [ "help" ]

# Expose the odoo ports (for linked containers)
EXPOSE 8069 8072
2 changes: 1 addition & 1 deletion OCB_COMMIT_ID
Original file line number Diff line number Diff line change
@@ -1 +1 @@
95573b6dffc735fc2f7d0fb3ea2808cc16219638
95573b6dffc735fc2f7d0fb3ea2808cc16219638
Loading

0 comments on commit 0073a93

Please sign in to comment.