-
Notifications
You must be signed in to change notification settings - Fork 15
/
8.0.Dockerfile
182 lines (157 loc) · 6.43 KB
/
8.0.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
FROM debian:8 AS base
EXPOSE 8069 8072
# Enable Odoo user and filestore
RUN useradd -md /home/odoo -s /bin/false odoo \
&& mkdir -p /var/lib/odoo \
&& chown -R odoo:odoo /var/lib/odoo \
&& sync
# System environment variables
ENV GIT_AUTHOR_NAME=docker-odoo \
GIT_COMMITTER_NAME=docker-odoo \
LC_ALL=C.UTF-8 \
NODE_PATH=/usr/local/lib/node_modules:/usr/lib/node_modules \
PATH="/home/odoo/.local/bin:$PATH" \
PIP_NO_CACHE_DIR=0 \
PYTHONOPTIMIZE=1
# Default values of env variables used by scripts
ENV ODOO_SERVER=odoo \
UNACCENT=True \
PROXY_MODE=True \
WITHOUT_DEMO=True \
WAIT_PG=true \
PGUSER=odoo \
PGPASSWORD=odoo \
PGHOST=db \
PGPORT=5432 \
ADMIN_PASSWORD=admin
# Other requirements and recommendations to run Odoo
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
ARG WKHTMLTOPDF_VERSION=0.12.5
ARG WKHTMLTOPDF_CHECKSUM='2583399a865d7604726da166ee7cec656b87ae0a6016e6bce7571dcd3045f98b'
RUN sed -Ei 's@(^deb http://deb.debian.org/debian jessie-updates main$)@#\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 \
libldap-2.4-2 libsasl2-2 libx11-6 libxext6 libxrender1 \
locales-all zlibc \
bzip2 ca-certificates curl gettext-base git nano \
openssh-client telnet xz-utils \
sudo \
wget \
&& curl https://bootstrap.pypa.io/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.jessie_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 \
&& rm -Rf /var/lib/apt/lists/*
# Special case to get latest PostgreSQL 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 - \
&& apt-get update \
&& apt-get install -y --no-install-recommends postgresql-client \
&& rm -Rf /var/lib/apt/lists/* /tmp/*
# 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/
# 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_VERSION=8.0
ARG ODOO_SOURCE=odoo/odoo
ARG ODOO_SOURCE_DEPTH=1
ENV ODOO_VERSION="$ODOO_VERSION"
ENV ODOO_SOURCE="$ODOO_SOURCE"
ENV ODOO_SOURCE_DEPTH="$ODOO_SOURCE_DEPTH"
RUN debs="python-dev build-essential libxml2-dev libxslt1-dev libjpeg-dev libfreetype6-dev liblcms2-dev libopenjpeg-dev libtiff5-dev tk-dev tcl-dev linux-headers-amd64 libpq-dev libldap2-dev libsasl2-dev" \
&& apt-get update \
&& apt-get install -yqq --no-install-recommends $debs \
&& pip install \
-r https://raw.githubusercontent.com/$ODOO_SOURCE/$ODOO_VERSION/requirements.txt \
phonenumbers \
watchdog \
&& apt-get purge -yqq $debs \
&& rm -Rf /var/lib/apt/lists/* /tmp/*
# Other pip requirements and utilities
RUN pip install --no-cache-dir \
phonenumbers \
git-aggregator \
click-odoo-contrib
# Metadata
ARG VCS_REF
ARG BUILD_DATE
ARG VERSION
LABEL org.label-schema.schema-version="$VERSION" \
org.label-schema.vendor=Adhoc \
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/ingadhoc/docker-odoo"
# Create directory structure
ENV SOURCES /home/odoo/src
ENV CUSTOM /home/odoo/custom
ENV RESOURCES /home/odoo/.resources
ENV CONFIG_DIR /home/odoo/.config
ENV DATA_DIR /home/odoo/data
ENV OPENERP_SERVER=$CONFIG_DIR/odoo.conf
ENV ODOO_RC=$OPENERP_SERVER
RUN mkdir -p $SOURCES/repositories && \
mkdir -p $CUSTOM/repositories && \
mkdir -p $DATA_DIR && \
mkdir -p $CONFIG_DIR && \
mkdir -p $RESOURCES && \
chown -R odoo.odoo /home/odoo && \
sync
# Image building scripts
COPY bin/* /usr/local/bin/
COPY build.d $RESOURCES/build.d
COPY conf.d $RESOURCES/conf.d
COPY entrypoint.d $RESOURCES/entrypoint.d
COPY entrypoint.sh $RESOURCES/entrypoint.sh
COPY resources/* $RESOURCES/
RUN ln /usr/local/bin/direxec $RESOURCES/entrypoint \
&& ln /usr/local/bin/direxec $RESOURCES/build \
&& chown -R odoo.odoo $RESOURCES \
&& chmod -R a+rx $RESOURCES/entrypoint* $RESOURCES/build* /usr/local/bin \
&& sync
# Run build scripts
RUN $RESOURCES/build && sync
# Entrypoint
WORKDIR "/home/odoo"
ENTRYPOINT ["/home/odoo/.resources/entrypoint.sh"]
CMD ["odoo"]
USER odoo
# HACK Special case for Werkzeug
RUN pip install --user Werkzeug==0.14.1
#
# Odoo
#
FROM base AS odoo
RUN git clone --single-branch --depth $ODOO_SOURCE_DEPTH --branch $ODOO_VERSION https://github.com/$ODOO_SOURCE $SOURCES/odoo
RUN pip install --user --no-cache-dir $SOURCES/odoo
# Simulate odoo bin
RUN if [ -f /home/odoo/.local/bin/openerp-server ]; then cp /home/odoo/.local/bin/openerp-server /home/odoo/.local/bin/odoo; fi
#
# Odoo Enterprise
#
FROM odoo AS enterprise
ARG GITHUB_USER
ARG GITHUB_TOKEN
ENV GITHUB_USER="$GITHUB_USER"
ENV GITHUB_TOKEN="$GITHUB_TOKEN"
RUN git clone --single-branch --depth $ODOO_SOURCE_DEPTH --branch $ODOO_VERSION https://$GITHUB_USER:[email protected]/odoo/enterprise.git $SOURCES/enterprise