-
Notifications
You must be signed in to change notification settings - Fork 15
/
12.0.Dockerfile
175 lines (153 loc) · 5.48 KB
/
12.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
FROM python:3.5-stretch 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='1140b0ab02aa6e17346af2f14ed0de807376de475ba90e1db3975f112fbd20bb'
RUN apt-get -qq update \
&& apt-get -yqq upgrade \
&& apt-get install -yqq --no-install-recommends \
chromium \
ffmpeg \
fonts-liberation2 \
gettext-base \
gnupg2 \
locales-all \
nano \
ruby \
telnet \
vim \
zlibc \
sudo \
&& echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' >> /etc/apt/sources.list.d/postgresql.list \
&& curl -SL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& curl https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3 /dev/stdin \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get update \
&& apt-get install -yqq --no-install-recommends nodejs postgresql-client-13 \
&& 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 - \
&& apt-get install -yqq --no-install-recommends ./wkhtmltox.deb \
&& rm wkhtmltox.deb \
&& wkhtmltopdf --version \
&& rm -Rf /var/lib/apt/lists/* /tmp/*
# Special case to get latest Less
RUN ln -s /usr/bin/nodejs /usr/local/bin/node \
&& npm install -g less \
&& rm -Rf ~/.npm /tmp/*
# 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=12.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="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 \
'websocket-client~=0.53' \
&& (python3 -m compileall -q /usr/local/lib/python3.5/ || true) \
&& 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 \
ipython \
pysnooper \
ipdb \
git+git://github.com/OCA/openupgradelib.git \
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
# Usefull aliases
RUN echo "alias odoo-shell='odoo shell --shell-interface ipython --no-http --limit-memory-hard=0 --limit-memory-soft=0'" >> /home/odoo/.bashrc
# 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
#
# 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