diff --git a/Dockerfile b/Dockerfile index c0cc0d8..b98b43d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,13 +16,14 @@ RUN apt update -y \ # Install Wine and dependencies RUN dpkg --add-architecture i386 \ && apt update -y \ - && apt install -y software-properties-common gnupg2 \ - && wget -qO - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - \ - && echo "deb https://dl.winehq.org/wine-builds/debian/ bullseye main" >> /etc/apt/sources.list.d/winehq.list \ + && apt install -y software-properties-common gnupg2 ca-certificates \ + && wget -qO - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor -o /usr/share/keyrings/winehq-archive-keyring.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/winehq-archive-keyring.gpg] https://dl.winehq.org/wine-builds/debian/ bullseye main" >> /etc/apt/sources.list.d/winehq.list \ && apt update -y \ && apt install -y winehq-stable \ - && apt install -y winetricks \ - && apt install -y xvfb \ + && apt install -y xvfb cabextract \ + && wget -q https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/local/bin/winetricks \ + && chmod +x /usr/local/bin/winetricks \ && apt clean \ && rm -rf /var/lib/apt/lists/* USER container @@ -33,19 +34,13 @@ ENV WINEARCH=win64 ENV WINEPREFIX=/home/container/.wine ENV DISPLAY=:99.0 -# Initialize Wine prefix as container user -RUN Xvfb :99 -screen 0 1024x768x16 & \ - export DISPLAY=:99.0 && \ - wine --version && \ - wineboot --init && \ - winetricks -q corefonts && \ - pkill Xvfb - WORKDIR /home/container STOPSIGNAL SIGINT COPY --chown=container:container ./../entrypoint.sh /entrypoint.sh +COPY --chown=container:container ./../test-wine-dotnet.sh /test-wine-dotnet.sh RUN chmod +x /entrypoint.sh +RUN chmod +x /test-wine-dotnet.sh ENTRYPOINT ["/usr/bin/tini", "-g", "--"] CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 4220dcb..e2fdb39 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,6 +12,14 @@ export DOTNET_ROOT=/usr/share/ Xvfb :99 -screen 0 1024x768x16 & export DISPLAY=:99.0 +# Initialize Wine prefix if it doesn't exist +if [ ! -d "$WINEPREFIX" ]; then + echo "Initializing Wine prefix..." + wineboot --init + winetricks -q corefonts + echo "Wine initialization complete." +fi + # print the dotnet version on startup printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n" dotnet --version diff --git a/test-wine-dotnet.sh b/test-wine-dotnet.sh new file mode 100644 index 0000000..97fc7f1 --- /dev/null +++ b/test-wine-dotnet.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +echo "Testing Wine + .NET integration..." + +# Test 1: Check if .NET works natively +echo "1. Testing native .NET:" +dotnet --version + +# Test 2: Check if Wine works +echo "2. Testing Wine:" +wine --version + +# Test 3: Test Wine with .NET (this will use .NET through Wine) +echo "3. Testing .NET through Wine:" +wine dotnet --version + +# Test 4: Create a simple .NET console app and run it through Wine +echo "4. Creating and running a simple .NET app through Wine:" +dotnet new console -n TestApp -o /tmp/testapp +cd /tmp/testapp +dotnet build +wine dotnet /tmp/testapp/bin/Debug/net9.0/TestApp.dll + +echo "Wine + .NET integration test completed!"