-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-build-buildpack
executable file
·68 lines (60 loc) · 2.39 KB
/
pre-build-buildpack
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
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE="dokku/$APP"
echo "-----> Installing weasyprint ..."
COMMAND=$(cat <<EOF
echo "-----> upgrade openssl"
wget --no-check-certificate https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/ca-certificates/20210119~20.04.2/ca-certificates_20210119~20.04.2.tar.xz
unxz ca-certificates_20210119~20.04.2.tar.xz
tar -xf ca-certificates_20210119~20.04.2.tar
cd ca-certificates-20210119~20.04.1
make
make install
echo 'mozilla/ISRG_Root_X1.crt' | tee -a /etc/ca-certificates.conf
sed -i"" 's/mozilla\/DST_Root_CA_X3.crt/!mozilla\/DST_Root_CA_X3.crt/' /etc/ca-certificates.conf
dpkg-reconfigure -fnoninteractive ca-certificates
cd /etc/ssl/certs/
/usr/bin/c_rehash
cd /
wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz
tar xzvf openssl-1.1.1f.tar.gz
cd openssl-1.1.1f
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'
make
make install
grep -v "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" /etc/apt/sources.list > temp.txt; mv temp.txt /etc/apt/sources.list
echo "-----> install requirements"
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get install -y build-essential zlib1g-dev python3-dev python3-pip python3-setuptools python3-wheel python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
echo "-----> install python3.7"
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar -xvf Python-3.7.2.tgz
cd Python-3.7.2
./configure --enable-optimizations
make altinstall
python3.7 -V
echo "-----> pip install certifi"
pip3.7 install certifi
cp /usr/local/lib/python3.7/site-packages/certifi/cacert.pem /usr/local/ssl/cert.pem
echo "-----> upgraded cairo"
rm /usr/lib/x86_64-linux-gnu/libcairo* &&
wget -c https://cairographics.org/releases/cairo-1.16.0.tar.xz &&
tar -xJf cairo-1.16.0.tar.xz && rm cairo-1.16.0.tar.xz
cd cairo-1.16.0/
./configure && make && make install &&
cp /usr/local/lib/libcairo* /usr/lib/x86_64-linux-gnu/
echo "-----> pip install cairocffi"
pip3.7 install cairocffi==1.4.0
echo "-----> pip install weasyprint"
pip3.7 install weasyprint==52.5
echo "-----> weasyprint installed!"
weasyprint --version
sleep 1 # wait so that docker run has not exited before docker attach
EOF
)
id=$(docker run --privileged -d $IMAGE /bin/bash -e -c "$COMMAND")
#enable logs
docker attach $id
test $(docker wait $id) -eq 0
docker commit $id $IMAGE > /dev/null