Repository navigation
Expand file tree
/
Copy pathContainerfile.full
More file actions
138 lines (117 loc) · 6.12 KB
/
Copy pathContainerfile.full
File metadata and controls
138 lines (117 loc) · 6.12 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# TPV + QZ in one image: Wine 11.0 + DXVK + VKD3D-Proton for TrainingPeaks
# Virtual, and qdomyos-zwift as the DIRCON bridge that feeds it the trainer.
#
# Stage 1 compiles QZ. Stage 2 adds Wine, the graphics translation layers, and
# a template WINEPREFIX with the TPV launcher installed. TPV's game data is not
# baked in: its launcher fetches and self-updates it, and TPV is proprietary and
# must not be redistributed. First run populates a persistent volume instead.
ARG DEBIAN_RELEASE=trixie
# ---------------------------------------------------------------- stage 1: QZ
FROM debian:${DEBIAN_RELEASE} AS qzbuild
ARG QZ_REPO=https://github.com/cagnulein/qdomyos-zwift.git
ARG QZ_COMMIT=446f37d8ecc0e011855629abea665a20a47de5bf
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates \
qtbase5-dev qtbase5-private-dev qtconnectivity5-dev qtlocation5-dev \
qtmultimedia5-dev qtdeclarative5-dev qtquickcontrols2-5-dev \
qtpositioning5-dev \
libqt5charts5-dev libqt5networkauth5-dev libqt5svg5-dev \
libqt5texttospeech5-dev libqt5websockets5-dev libqt5sensors5-dev \
qttools5-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
RUN git init -q . \
&& git remote add origin "${QZ_REPO}" \
&& git fetch -q --depth 1 origin "${QZ_COMMIT}" \
&& git checkout -q FETCH_HEAD \
&& git submodule update -q --init --recursive --depth 1
COPY patches/0001-allow-unprivileged-start.patch /tmp/
RUN git apply --verbose /tmp/0001-allow-unprivileged-start.patch
RUN mkdir -p /build && cd /build \
&& qmake /src/src/qdomyos-zwift.pro CONFIG-=ltcg CONFIG-=optimize_full CONFIG+=release \
&& make -j"$(nproc)"
# ------------------------------------------------------- stage 2: Wine + TPV
FROM debian:${DEBIAN_RELEASE} AS runtime
ARG WINE_VERSION=11.0.0.0~trixie-1
# Each graphics-layer version is pinned with its release tarball's sha256, so a
# swapped or tampered tarball fails the build. Bump the two lines together.
ARG DXVK_VERSION=3.1
ARG DXVK_SHA256=30f9cc326874be344285582275446968cfa4c069db31ce56df312d6644179154
ARG VKD3D_VERSION=3.0.1
ARG VKD3D_SHA256=3cf2315522af5e43605ef6d3c41dad91387040bf97199934f3f7ab76caaa2f0c
ARG TPV_INSTALLER_URL=https://virtual.trainingpeaks.com/TPVirtual-Installer_v6.exe
ENV DEBIAN_FRONTEND=noninteractive
# The TPV installer is PE32, so WoW64 needs the i386 architecture enabled.
# One apt index for the base, Mesa backports and WineHQ together: the repos are
# added before the single update, so the package lists are fetched once and
# dropped once rather than three times.
ARG MESA_SUITE=trixie-backports
RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates curl \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://dl.winehq.org/wine-builds/winehq.key \
-o /etc/apt/keyrings/winehq-archive.key \
&& echo "deb [signed-by=/etc/apt/keyrings/winehq-archive.key] https://dl.winehq.org/wine-builds/debian/ trixie main" \
> /etc/apt/sources.list.d/winehq.list \
&& echo "deb http://deb.debian.org/debian ${MESA_SUITE} main" \
> /etc/apt/sources.list.d/mesa.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
zstd xvfb procps iproute2 \
avahi-utils \
libqt5bluetooth5 libqt5charts5 libqt5core5t64 libqt5dbus5 libqt5gui5 \
libqt5location5 libqt5multimedia5 libqt5network5 libqt5networkauth5 \
libqt5positioning5 libqt5qml5 libqt5quick5 libqt5sql5 libqt5sql5-sqlite \
libqt5texttospeech5 libqt5websockets5 libqt5widgets5 libqt5xml5 \
qml-module-qtquick2 \
libvulkan1 libvulkan1:i386 \
libglib2.0-bin \
&& apt-get install -y --no-install-recommends -t "${MESA_SUITE}" \
mesa-vulkan-drivers mesa-vulkan-drivers:i386 libgl1-mesa-dri libgl1-mesa-dri:i386 \
&& apt-get install -y --install-recommends "winehq-stable=${WINE_VERSION}" \
&& rm -rf /var/lib/apt/lists/*
# DXVK and VKD3D-Proton, at the versions proven in the Bottles setup. Downloaded
# to disk rather than piped into tar so the bytes can be checked before they run.
# --strict is load-bearing: without it a blank or malformed checksum line is a
# warning only, and the archive it belongs to would be extracted unverified.
RUN curl -fsSL -o /tmp/dxvk.tar.gz \
"https://github.com/doitsujin/dxvk/releases/download/v${DXVK_VERSION}/dxvk-${DXVK_VERSION}.tar.gz" \
&& curl -fsSL -o /tmp/vkd3d.tar.zst \
"https://github.com/HansKristian-Work/vkd3d-proton/releases/download/v${VKD3D_VERSION}/vkd3d-proton-${VKD3D_VERSION}.tar.zst" \
&& printf '%s /tmp/dxvk.tar.gz\n%s /tmp/vkd3d.tar.zst\n' "${DXVK_SHA256}" "${VKD3D_SHA256}" \
| sha256sum --strict -c - \
&& tar -xz -C /opt -f /tmp/dxvk.tar.gz \
&& tar --zstd -x -C /opt -f /tmp/vkd3d.tar.zst \
&& rm -f /tmp/dxvk.tar.gz /tmp/vkd3d.tar.zst
# uid 1000 so podman --userns=keep-id maps the host user onto this account and
# the prefix and volumes stay writable.
RUN useradd -m -u 1000 -s /bin/bash tpv \
&& mkdir -p /opt/tpv && chown tpv:tpv /opt/tpv
# Only the two scripts the prefix build needs. Copying the rest here would make
# any script edit re-run the TPV installer below.
COPY scripts/build-prefix.sh scripts/xvfb-lib.sh /opt/scripts/
RUN chmod +x /opt/scripts/*.sh
USER tpv
ENV WINEPREFIX=/opt/tpv/wine-template \
WINEARCH=win64 \
WINEDEBUG=-all \
WINEDLLOVERRIDES=mscoree,mshtml=
RUN /opt/scripts/build-prefix.sh
USER root
RUN chown -R tpv:tpv /opt/tpv
# Everything below is cheap to rebuild, so it sits after the prefix: bumping
# QZ_COMMIT or editing a script no longer reruns the Wine prefix build.
COPY --from=qzbuild /build/qdomyos-zwift /opt/qz/qdomyos-zwift
COPY scripts/ /opt/scripts/
# Wine opens links via xdg-open; this one forwards them to the host browser.
RUN chmod +x /opt/scripts/*.sh \
&& ln -sf /opt/scripts/xdg-open-host.sh /usr/local/bin/xdg-open
USER tpv
# See README: Qt resolves bluetoothd's path from /proc then execs it inside the
# container, where it is absent; the "4.0" fallback selects a raw-L2CAP backend
# that cannot connect.
ENV BLUETOOTH_FORCE_DBUS_LE_VERSION=5.42 \
TPV_HOME=/state
ENTRYPOINT ["/opt/scripts/entrypoint.sh"]
CMD ["both"]