This repository has been archived by the owner on Dec 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
/
Dockerfile
131 lines (116 loc) · 4.95 KB
/
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
FROM debian:stretch
#######
# ENV #
#######
ENV ODOO_BRANCH=12.0 \
WKHTMLTOPDF_VERSION=0.12.4 \
WKHTMLTOPDF_CHECKSUM='049b2cdec9a8254f0ef8ac273afaf54f7e25459a273e27189591edc7d7cf29db' \
OPENERP_SERVER=/mnt/config/odoo-server.conf \
ODOO_SOURCE_DIR=/mnt/odoo-source \
ADDONS_DIR=/mnt/addons \
BACKUPS_DIR=/mnt/backups \
LOGS_DIR=/mnt/logs \
ODOO_DATA_DIR=/mnt/data-dir
################
# dependencies #
################
# Based on https://github.com/Tecnativa/docker-odoo-base
# Other requirements and recommendations to run Odoo
# See https://github.com/$ODOO_SOURCE/blob/$ODOO_VERSION/debian/control
RUN set -x; \
apt-get -qq update \
&& apt-get -yqq upgrade \
&& apt-get install -yqq --no-install-recommends \
python3 ruby-compass \
python3-libsass \
fontconfig libfreetype6 libxml2 libxslt1.1 libjpeg62-turbo zlib1g \
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-base git gnupg2 nano \
openssh-client postgresql-client telnet xz-utils \
&& curl https://bootstrap.pypa.io/get-pip.py | python3 /dev/stdin --no-cache-dir \
&& curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get install -yqq nodejs \
&& apt-get -yqq purge python2.7 \
&& apt-get -yqq autoremove \
&& rm -Rf /var/lib/apt/lists/*
# Special case to get latest Less
RUN ln -s /usr/bin/nodejs /usr/local/bin/node \
&& npm install -g less \
&& 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 bootstrap-sass --version '<3.4' \
&& rm -Rf ~/.gem /var/lib/gems/*/cache/
# Special case for wkhtmltox
RUN curl -SLo wkhtmltox.tar.xz https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox-${WKHTMLTOPDF_VERSION}_linux-generic-amd64.tar.xz \
&& echo "${WKHTMLTOPDF_CHECKSUM} wkhtmltox.tar.xz" | sha256sum -c - \
&& tar --strip-components 1 -C /usr/local/ -xf wkhtmltox.tar.xz \
&& rm wkhtmltox.tar.xz \
&& wkhtmltopdf --version
RUN apt-get update \
&& apt-get install -y \
build-essential \
libevent-dev \
libjpeg-dev \
libldap2-dev \
libsasl2-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
python3-dev \
zlib1g-dev \
&& pip install openupgradelib \
&& pip install --no-cache-dir -r https://raw.githubusercontent.com/odoo/odoo/${ODOO_BRANCH}/requirements.txt \
&& pip install --no-cache-dir -r https://raw.githubusercontent.com/it-projects-llc/saas-addons/${ODOO_BRANCH}/requirements.txt \
&& pip install --no-cache-dir -r https://raw.githubusercontent.com/it-projects-llc/misc-addons/${ODOO_BRANCH}/requirements.txt \
&& python3 -m compileall -q /usr/local/lib/python3.5/ || true \
&& apt-get purge -yqq build-essential '*-dev' \
&& apt-mark -qq manual '*' \
&& rm -Rf /var/lib/apt/lists/*
#####################################
# odoo source, user, docker folders #
#####################################
RUN git clone --depth=1 -b ${ODOO_BRANCH} https://github.com/odoo/odoo.git $ODOO_SOURCE_DIR && \
adduser --system --quiet --shell=/bin/bash --home=/opt/odoo --group odoo && \
chown -R odoo:odoo $ODOO_SOURCE_DIR && \
mkdir -p $ODOO_SOURCE_DIR && chown odoo $ODOO_SOURCE_DIR && \
mkdir -p $ADDONS_DIR/extra && chown -R odoo $ADDONS_DIR && \
mkdir -p $ODOO_DATA_DIR && chown odoo $ODOO_DATA_DIR && \
mkdir -p /mnt/config && chown odoo /mnt/config && \
mkdir -p $BACKUPS_DIR && chown odoo $BACKUPS_DIR && \
mkdir -p $LOGS_DIR && chown odoo $LOGS_DIR
###############################################
# config, scripts, repos, autoinstall modules #
###############################################
COPY install-odoo-saas.sh /
COPY configs-docker-container/odoo-server.conf $OPENERP_SERVER
COPY odoo-backup.py /usr/local/bin/
RUN apt-get -qq update && \
chmod +x /usr/local/bin/odoo-backup.py && \
chown odoo:odoo $OPENERP_SERVER && \
CLONE_IT_PROJECTS_LLC=yes \
CLONE_OCA=yes \
INIT_ODOO_CONFIG=docker-container \
UPDATE_ADDONS_PATH=yes \
ADD_AUTOINSTALL_MODULES="['ir_attachment_force_storage', 'base_session_store_psql']" \
ADD_IGNORED_DATABASES="['session_store']" \
bash -x install-odoo-saas.sh
COPY reset-admin-passwords.py /
########################
# docker configuration #
########################
COPY ./entrypoint.sh /
EXPOSE 8069 8072
USER odoo
VOLUME ["/mnt/data-dir", \
"/mnt/backups", \
"/mnt/logs", \
"/mnt/addons/extra"]
# /mnt/addons/extra is used for manually added addons.
# Expected structure is:
# /mnt/addons/extra/REPO_OR_GROUP_NAME/MODULE/__openerp__.py
#
# we don't add /mnt/odoo-source, /mnt/addons, /mnt/config to VOLUME in order to allow modify theirs content in inherited dockers
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/mnt/odoo-source/odoo-bin"]