-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from seb-elico/9.0-minor-bugfixes
Re-do #70
- Loading branch information
Showing
9 changed files
with
887 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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=9.0 \ | ||
PG_VERSION=9.5 \ | ||
BINARY_NAME=openerp-server | ||
|
||
# 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 | ||
|
@@ -11,17 +19,17 @@ 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 \ | ||
|
@@ -68,17 +76,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 | ||
|
@@ -88,17 +93,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 9.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 [ \ | ||
|
@@ -110,10 +115,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 |
Oops, something went wrong.