-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
115 lines (94 loc) · 3.85 KB
/
Copy pathDockerfile
File metadata and controls
115 lines (94 loc) · 3.85 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
FROM ubuntu:22.04 AS builder_loop
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# Install required packages (base + Qt dependencies)
RUN apt update && apt install -y \
git build-essential cmake curl unzip ninja-build \
g++ wget pkg-config make zip tar python3 nano sudo \
software-properties-common ca-certificates gnupg \
lsb-release libfontconfig-dev libpulse-dev libpulse0 \
libpipewire-0.3-0 libxcb-cursor0 libxcb-xinerama0 \
libxkbcommon-x11-0 libx11-xcb1 libxcb1 libxcb-render0 \
libxcb-shape0 libxcb-shm0 libopengl-dev libgl1-mesa-dev \
libxcb-icccm4 libxcb-util1 libxcb-image0 libxcb-keysyms1 \
libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 \
libxcb-sync1 libxcb-xkb1 python3 python3-pip \
&& apt clean
# Clone and bootstrap vcpkg
WORKDIR /opt
RUN git clone https://github.com/Microsoft/vcpkg.git
WORKDIR /opt/vcpkg
RUN ./bootstrap-vcpkg.sh -disableMetrics
ENV VCPKG_ROOT=/opt/vcpkg
# Clone LOOP
WORKDIR /root
RUN git clone https://github.com/JakubMelka/PDF4QT.git
ENV VCPKG_OVERLAY_PORTS=/root/LOOP/vcpkg/overlays
RUN pip install aqtinstall
RUN aqt list-qt linux desktop --arch 6.11.1 > /root/available_qt_versions.txt
RUN aqt install-qt linux desktop 6.11.1 linux_gcc_64 -O /opt/Qt -m qtmultimedia qtspeech
# Set environment variables
ENV PATH=/opt/Qt/6.11.1/gcc_64/bin:$PATH
ENV CMAKE_PREFIX_PATH=/opt/Qt/6.11.1/gcc_64/lib/cmake
ENV VCPKG_ROOT=/opt/vcpkg
ENV VCPKG_OVERLAY_PORTS=/root/LOOP/vcpkg/overlays
ENV LOOP_QT_ROOT=/opt/Qt/6.11.1/gcc_64
ENV LD_LIBRARY_PATH=/opt/Qt/6.11.1/gcc_64/lib:$LD_LIBRARY_PATH
ENV QT_QPA_PLATFORM=offscreen
# Persist env variables to root shell
RUN echo 'export PATH=/opt/Qt/6.11.1/gcc_64/bin:$PATH' >> /root/.bashrc && \
echo 'export CMAKE_PREFIX_PATH=/opt/Qt/6.11.1/gcc_64/lib/cmake' >> /root/.bashrc && \
echo 'export VCPKG_ROOT=/opt/vcpkg' >> /root/.bashrc && \
echo 'export VCPKG_OVERLAY_PORTS=/root/LOOP/vcpkg/overlays' >> /root/.bashrc && \
echo 'export LOOP_QT_ROOT=/opt/Qt/6.11.1/gcc_64' >> /root/.bashrc && \
echo 'export LD_LIBRARY_PATH=/opt/Qt/6.11.1/gcc_64/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \
echo 'export QT_QPA_PLATFORM=offscreen' >> /root/.bashrc
# Reinstall essential tools (redundant but safe)
RUN apt update && apt install -y build-essential cmake g++ make ninja-build && apt clean
# Final working directory
WORKDIR /root/LOOP
RUN cmake -B build -S . -DLOOP_INSTALL_QT_DEPENDENCIES=0 \
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VCPKG_BUILD_TYPE=Release \
-DVCPKG_OVERLAY_PORTS=vcpkg/overlays \
-DLOOP_INSTALL_TO_USR=OFF \
-DCMAKE_INSTALL_PREFIX="/" \
-DLOOP_QT_ROOT=/opt/Qt/6.11.1/gcc_64
RUN cmake --build build --target all release_translations -j$(nproc)
RUN cmake --install build --prefix /install
# Delete all static libraries (they are not needed in the final docker image)
RUN find /opt/Qt/6.11.1/gcc_64/lib -type f -name "*.a" -delete
# Final working directory
WORKDIR /root
FROM ubuntu:22.04 AS runtime_loop
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get update && apt-get install -y \
libglx-mesa0 \
libgl1-mesa-glx \
libglu1-mesa \
libegl1-mesa \
libx11-6 \
libxext6 \
libxrender1 \
libxcb1 \
libxcb-glx0 \
libxcb-render0 \
libxcb-shm0 \
libpng16-16 \
libfontconfig1 \
libglib2.0-0 \
libxkbcommon0 \
libdbus-1-3 \
&& apt clean
COPY --from=builder_loop /opt/Qt /opt/Qt
COPY --from=builder_loop /install /
# Persist env variables to root shell
RUN echo 'export PATH=/opt/Qt/6.11.1/gcc_64/bin:$PATH' >> /root/.bashrc && \
echo 'export LD_LIBRARY_PATH=/opt/Qt/6.11.1/gcc_64/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \
echo 'export QT_QPA_PLATFORM=offscreen' >> /root/.bashrc
WORKDIR /root
CMD ["bash"]