forked from madnight/docker-alpine-wkhtmltopdf
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
171 lines (162 loc) · 7.29 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
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
ARG ALPINE_VERSION=3.18
ARG WKHTMLTOX_VERSION=0.12.6
FROM --platform=$BUILDPLATFORM alpine:$ALPINE_VERSION
ENV REPO=https://github.com/wkhtmltopdf/wkhtmltopdf.git
# Copy patches
RUN mkdir -p /tmp/patches
COPY patches/* /tmp/patches/
# Install needed packages
RUN apk add --no-cache \
libstdc++ \
libx11 \
libxrender \
libxext \
libssl1.1 \
ca-certificates \
fontconfig \
freetype \
ttf-dejavu \
ttf-droid \
ttf-freefont \
ttf-liberation \
ttf-ubuntu-font-family \
&& apk add --no-cache --virtual .build-deps \
g++ \
git \
gtk+ \
gtk+-dev \
make \
mesa-dev \
msttcorefonts-installer \
openssl-dev \
patch \
fontconfig-dev \
freetype-dev \
&& update-ms-fonts \
&& fc-cache -f
# Download source files
RUN git clone --recursive $REPO /tmp/wkhtmltopdf \
&& cd /tmp/wkhtmltopdf \
&& git checkout $WKHTMLTOX_VERSION \
\
# Apply patches
&& cd /tmp/wkhtmltopdf/qt \
&& patch -p1 -i /tmp/patches/qt-musl.patch \
&& patch -p1 -i /tmp/patches/qt-musl-iconv-no-bom.patch \
&& patch -p1 -i /tmp/patches/qt-recursive-global-mutex.patch \
&& patch -p1 -i /tmp/patches/qt-gcc6.patch \
\
# Modify qmake config
&& sed -i "s|-O2|$CXXFLAGS|" mkspecs/common/g++.conf \
&& sed -i "/^QMAKE_RPATH/s| -Wl,-rpath,||g" mkspecs/common/g++.conf \
&& sed -i "/^QMAKE_LFLAGS\s/s|+=|+= $LDFLAGS|g" mkspecs/common/g++.conf
WORKDIR /tmp/wkhtmltopdf/qt
# Install qt
RUN ./configure -confirm-license -opensource \
-prefix /usr \
-datadir /usr/share/qt \
-sysconfdir /etc \
-plugindir /usr/lib/qt/plugins \
-importdir /usr/lib/qt/imports \
-silent \
-release \
-static \
-webkit \
-script \
-svg \
-exceptions \
-xmlpatterns \
-openssl-linked \
-no-fast \
-no-largefile \
-no-accessibility \
-no-stl \
-no-sql-ibase \
-no-sql-mysql \
-no-sql-odbc \
-no-sql-psql \
-no-sql-sqlite \
-no-sql-sqlite2 \
-no-qt3support \
-no-opengl \
-no-openvg \
-no-system-proxies \
-no-multimedia \
-no-audio-backend \
-no-phonon \
-no-phonon-backend \
-no-javascript-jit \
-no-scripttools \
-no-declarative \
-no-declarative-debug \
-no-mmx \
-no-3dnow \
-no-sse \
-no-sse2 \
-no-sse3 \
-no-ssse3 \
-no-sse4.1 \
-no-sse4.2 \
-no-avx \
-no-neon \
-no-rpath \
-no-nis \
-no-cups \
-no-pch \
-no-dbus \
-no-separate-debug-info \
-no-gtkstyle \
-no-nas-sound \
-no-opengl \
-no-openvg \
-no-sm \
-no-xshape \
-no-xvideo \
-no-xsync \
-no-xinerama \
-no-xcursor \
-no-xfixes \
-no-xrandr \
-no-mitshm \
-no-xinput \
-no-xkb \
-no-glib \
-no-icu \
-nomake demos \
-nomake docs \
-nomake examples \
-nomake tools \
-nomake tests \
-nomake translations \
-graphicssystem raster \
-qt-zlib \
-qt-libpng \
-qt-libmng \
-qt-libtiff \
-qt-libjpeg \
-optimized-qmake \
-iconv \
-xrender \
-fontconfig \
-D ENABLE_VIDEO=0
RUN make -s --jobs 2 2> /dev/null
RUN make install \
\
# Install wkhtmltopdf
&& cd /tmp/wkhtmltopdf \
&& qmake \
&& make --jobs 2 --silent \
&& make install \
&& make clean \
&& make distclean \
\
# Uninstall qt
&& cd /tmp/wkhtmltopdf/qt \
&& make uninstall \
&& make clean \
&& make distclean \
\
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps
RUN sha256sum /bin/wkhtmltopdf