Skip to content

Commit

Permalink
added wine as a part of Dockerfile and made it possible to tweak vers…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
netbrain committed Dec 7, 2023
1 parent 18a2be8 commit bfb319c
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/zwift_build_matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Zwift matrix build
on:
workflow_dispatch:
jobs:
zwift_build:
runs-on: ubuntu-22.04
timeout-minutes: 360
strategy:
matrix:
wine-version: ["8.0.2~bookworm-1", "8.0.1~bookworm-1", "8.0.0.0~bookworm-1", "7.0.2~bookworm-1", "7.0.1~bookworm-1", "7.0.0.0~bookworm-1", "6.0.4~bookworm-1", "6.0.3~bookworm-1", "6.0.2~bookworm-1"]
winetricks-version: ["master", "20230212", "20210206"]
wine-mono-version: ["7.0.0","7.1.0","7.1.1","7.2.0","7.3.0","7.4.0","8.0.0","8.1.0"]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install dependencies
run: sudo apt-get install -y x11-xserver-utils x11-apps

- uses: netbrain/[email protected]

- name: Checkout
uses: actions/checkout@v4

- name: Build zwift
run: |
set -x
export VERSION=$(curl -s http://cdn.zwift.com/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml | grep -oP 'sversion="\K.*?(?=")' | cut -f 1 -d ' ')
export BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo "Starting build..."
Xvfb :99 -ac -screen 0 "800x600x24" -nolisten tcp &
sleep 3
export DISPLAY=:99
docker build \
--build-arg="WINE_VERSION=${{ matrix.wine-version }}" \
--build-arg="WINETRICKS_VERSION=${{ matrix.winetricks-version }}" \
--build-arg="WINE_MONO_VERSION=${{ matrix.wine-mono-version }}" \
-t netbrain/zwift:build .
xhost +
docker run --name zwift \
--privileged \
-e DISPLAY=$DISPLAY \
--device /dev/dri \
-v /tmp:/tmp \
netbrain/zwift:build
73 changes: 72 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,78 @@ RUN git clone https://github.com/quietvoid/runfromprocess-rs .

RUN cargo build --target x86_64-pc-windows-gnu --release

FROM netbrain/wine:latest
FROM debian:bookworm-slim as wine-base
ARG WINE_VERSION=7.0.0.0~bookworm-1
ARG WINETRICKS_VERSION=20210206
ARG WINE_MONO_VERSION=7.0.0
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics,compat32,utility
ENV WINEDEBUG ${WINEDEBUG:-fixme-all}

RUN dpkg --add-architecture i386

RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
sudo \
wget \
unzip \
gnupg2 \
procps \
winbind \
pulseaudio \
ca-certificates \
libxau6 libxau6:i386 \
libxdmcp6 libxdmcp6:i386 \
libxcb1 libxcb1:i386 \
libxext6 libxext6:i386 \
libx11-6 libx11-6:i386 \
libglvnd0 libglvnd0:i386 \
libgl1 libgl1:i386 \
libglx0 libglx0:i386 \
libegl1 libegl1:i386 \
libgles2 libgles2:i386 \
libgl1-mesa-glx libgl1-mesa-glx:i386 \
libgl1-mesa-dri libgl1-mesa-dri:i386 && \
wget -qO - http://dl.winehq.org/wine-builds/winehq.key | apt-key add - && \
echo "deb https://dl.winehq.org/wine-builds/debian/ bookworm main" > \
/etc/apt/sources.list.d/winehq.list && \
sed -i '/^Types: deb/{:a; N; /\n$/!ba; s/Suites: \(.*\)/Suites: bullseye \1/}' /etc/apt/sources.list.d/debian.sources && \
apt-get update && \
apt-get -y install --install-recommends \
winehq-stable=${WINE_VERSION} \
wine-stable=${WINE_VERSION} \
wine-stable-amd64=${WINE_VERSION} \
wine-stable-i386=${WINE_VERSION} && \
rm -rf /var/lib/apt/lists/*

RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf

# Required for non-glvnd setups.
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/local/nvidia/lib:/usr/local/nvidia/lib64

COPY pulse-client.conf /etc/pulse/client.conf

RUN \
wget \
https://raw.githubusercontent.com/Winetricks/winetricks/${WINETRICKS_VERSION}/src/winetricks \
-O /usr/local/bin/winetricks && \
chmod +x /usr/local/bin/winetricks

RUN adduser --disabled-password --gecos '' user && \
adduser user sudo && \
echo '%SUDO ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER user
WORKDIR /home/user

RUN wget https://dl.winehq.org/wine/wine-mono/${WINE_MONO_VERSION}/wine-mono-${WINE_MONO_VERSION}-x86.msi \
-P /home/user/.cache/wine

FROM wine-base

LABEL org.opencontainers.image.authors="Kim Eik <[email protected]>"
LABEL org.opencontainers.image.title="netbrain/zwift"
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi
if [ ! "$(ls -A .)" ] # is directory empty?
then
#install dotnet > 4.7.2
winetricks --unattended dotnet48 win10
winetricks --force --unattended dotnet48 win10

#prevents warning when starting zwift for the first time
winetricks --unattended dotnet20 win10
Expand Down
9 changes: 9 additions & 0 deletions pulse-client.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Connect to the host's server using the mounted UNIX socket
default-server = unix:/run/user/1000/pulse/native

# Prevent a server running in the container
autospawn = no
daemon-binary = /bin/true

# Prevent the use of shared memory
enable-shm = false

0 comments on commit bfb319c

Please sign in to comment.