This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
build-image.sh
101 lines (85 loc) · 3.3 KB
/
build-image.sh
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
#!/usr/bin/env bash
# Exit inmediately after an error
# See vauxoo/docker-odoo-image#108
set -e
# With a little help from my friends
. /usr/share/vx-docker-internal/ubuntu-base/library.sh
. /usr/share/vx-docker-internal/odoo100/library.sh
. /etc/lsb-release
# Let's set some defaults here
ARCH="$( dpkg --print-architecture )"
NODE_UPSTREAM_REPO="deb http://deb.nodesource.com/node_5.x trusty main"
NODE_UPSTREAM_KEY="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
WKHTMLTOX_URL="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.${DISTRIB_CODENAME}_${ARCH}.deb"
ODOO_DEPENDENCIES=""
DEPENDENCIES_FILE="/usr/share/vx-docker-internal/odoo100/10.0-full_requirements.txt"
GEOIP2_URLS="https://s3.vauxoo.com/GeoLite2-City_20191224.tar.gz \
https://s3.vauxoo.com/GeoLite2-Country_20191224.tar.gz \
https://s3.vauxoo.com/GeoLite2-ASN_20191224.tar.gz"
EGENIX_BASE_URL="https://files.pythonhosted.org/packages/66/e6/e0709aedeb4a5c92a1aeb8c47ab50e9506eafc865806801bd3f01d72b671/egenix-mx-base-3.2.9.zip"
DPKG_DEPENDS="nodejs \
phantomjs \
antiword \
python-dev \
poppler-utils \
xmlstarlet \
xsltproc \
xz-utils \
swig \
libpq-dev \
libldap2-dev \
libsasl2-dev \
libssl-dev \
build-essential \
gfortran \
libfreetype6-dev \
zlib1g-dev \
libjpeg-dev \
libblas-dev \
liblapack-dev \
libxml2-dev \
libxslt1-dev \
libgeoip-dev \
fontconfig \
ghostscript \
cloc"
DPKG_UNNECESSARY=""
NPM_OPTS="-g"
NPM_DEPENDS="less@3.11.3 \
less-plugin-clean-css@1.5.1 \
jshint"
PIP_OPTS="--upgrade \
--no-cache-dir"
PIP_DEPENDS_EXTRA="requirements-parser==0.1.0 \
setuptools==33.1.1 \
git+https://github.com/vauxoo/pylint-odoo@master#egg=pylint-odoo \
git+https://github.com/vauxoo/panama-dv@master#egg=ruc"
PIP_DPKG_BUILD_DEPENDS=""
# Let's add the NodeJS upstream repo to install a newer version
add_custom_aptsource "${NODE_UPSTREAM_REPO}" "${NODE_UPSTREAM_KEY}"
# Release the apt monster!
apt-get update
apt-get upgrade
apt-get install ${DPKG_DEPENDS} ${PIP_DPKG_BUILD_DEPENDS}
# Install node dependencies
npm install ${NPM_OPTS} ${NPM_DEPENDS}
# Let's recursively find our pip dependencies
collect_pip_dependencies "${ODOO_DEPENDENCIES}" "${PIP_DEPENDS_EXTRA}" "${DEPENDENCIES_FILE}"
# Cleans incorrect dependency lines
clean_requirements ${DEPENDENCIES_FILE}
# Install python dependencies
pip install ${PIP_OPTS} -r ${DEPENDENCIES_FILE} --no-use-pep517
python --version
# Install qt patched version of wkhtmltopdf because of maintainer nonsense
wkhtmltox_install "${WKHTMLTOX_URL}"
# Install GeoIP database
geoip_install "${GEOIP2_URLS}"
egenixbase_install "${EGENIX_BASE_URL}"
# Remove build depends for pip
apt-get purge ${PIP_DPKG_BUILD_DEPENDS} ${DPKG_UNNECESSARY}
apt-get autoremove
# Final cleaning
rm -rf /tmp/*
find /var/tmp -type f -print0 | xargs -0r rm -rf
find /var/log -type f -print0 | xargs -0r rm -rf
find /var/lib/apt/lists -type f -print0 | xargs -0r rm -rf