-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
119 lines (108 loc) · 4.25 KB
/
Copy pathDockerfile
File metadata and controls
119 lines (108 loc) · 4.25 KB
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
# QtWeb Internet Browser - Docker build image
# Builds a static Linux x86_64 binary of QtWeb using Qt 4.8.5 + bundled WebKit.
#
# Usage (via the wrapper script):
# ./docker-build.sh [--jobs N] [--no-cache] [--output ./output]
#
# Manual usage:
# docker build -t qtweb-builder .
# docker run --rm -v "$(pwd)/output:/output" qtweb-builder
#
# The compiled binary will be placed in ./output/QtWeb
FROM ubuntu:18.04
LABEL description="QtWeb Internet Browser build environment"
LABEL qt_version="4.8.5"
# ---------------------------------------------------------------------------
# Build-time arguments
# ---------------------------------------------------------------------------
# Number of parallel compile jobs; override with --build-arg COMPILE_JOBS=N
ARG COMPILE_JOBS=4
# ---------------------------------------------------------------------------
# System packages
# ---------------------------------------------------------------------------
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
# Build essentials
build-essential \
g++ \
make \
perl \
patch \
ca-certificates \
# Download tools
wget \
curl \
# Qt 4 / X11 / GUI dependencies
libx11-dev \
libxext-dev \
libxrender-dev \
libxrandr-dev \
libxfixes-dev \
libxi-dev \
libxcursor-dev \
libxinerama-dev \
libfreetype6-dev \
libfontconfig1-dev \
libglib2.0-dev \
libgtk2.0-dev \
libssl1.0-dev \
zlib1g-dev \
libjpeg-dev \
libpng-dev \
# Needed by WebKit build system
bison \
flex \
gperf \
ruby \
python \
# Misc utilities
file \
&& rm -rf /var/lib/apt/lists/*
# ---------------------------------------------------------------------------
# Source versions
# ---------------------------------------------------------------------------
ENV QT_VERSION=4.8.5
ENV QT_SRC=qt-everywhere-opensource-src-${QT_VERSION}.tar.gz
# build.sh expects the webkit directory to be named exactly: webkit-qtwebkit-23
ENV QTWEBKIT_TAG=qtwebkit-2.3.1b
ENV QTWEBKIT_SRC=${QTWEBKIT_TAG}.tar.gz
# ---------------------------------------------------------------------------
# Copy project sources into the image
# ---------------------------------------------------------------------------
WORKDIR /build/qtweb
COPY . /build/qtweb/
# ---------------------------------------------------------------------------
# Download Qt and QtWebKit source tarballs (with multiple fallback mirrors)
# ---------------------------------------------------------------------------
RUN chmod +x /build/qtweb/docker/fetch-sources.sh && \
/build/qtweb/docker/fetch-sources.sh
# ---------------------------------------------------------------------------
# Extract Qt sources
# ---------------------------------------------------------------------------
RUN mkdir -p /build/qtweb/src/qt && \
echo ">>> Extracting Qt ${QT_VERSION} ..." && \
tar -C /build/qtweb/src/qt --strip-components=1 \
-xf /build/src-cache/${QT_SRC} && \
echo ">>> Extracting QtWebKit ..." && \
tar -C /build/qtweb/src/qt \
-xf /build/src-cache/${QTWEBKIT_SRC} && \
# Normalise the top-level directory name to what build.sh expects
WEBKIT_DIR=$(tar -tf /build/src-cache/${QTWEBKIT_SRC} | head -1 | cut -d/ -f1) && \
echo "WebKit dir inside tarball: $WEBKIT_DIR" && \
if [ "$WEBKIT_DIR" != "webkit-qtwebkit-23" ]; then \
mv /build/qtweb/src/qt/"$WEBKIT_DIR" /build/qtweb/src/qt/webkit-qtwebkit-23; \
fi && \
echo ">>> Source extraction complete."
# ---------------------------------------------------------------------------
# Build (using the project's own build.sh)
# ---------------------------------------------------------------------------
# Pass COMPILE_JOBS through as an environment variable so build.sh picks it up
# via the --jobs flag.
RUN bash /build/qtweb/build.sh --jobs "${COMPILE_JOBS}"
# ---------------------------------------------------------------------------
# Default command: copy the compiled binary to /output (mounted volume)
# ---------------------------------------------------------------------------
CMD ["/bin/bash", "-c", \
"mkdir -p /output && \
cp /build/qtweb/build/src/QtWeb /output/QtWeb && \
echo 'Build complete. Binary: /output/QtWeb'"]