Refactor entrypoint script by removing Wine setup and testing code

This commit is contained in:
2025-07-07 18:23:12 +02:00
parent dd68165b38
commit 2b951a139a
2 changed files with 1 additions and 79 deletions

View File

@@ -11,57 +11,13 @@ RUN apt update -y \
&& D_V="$(curl -sSL https://dotnet.microsoft.com/en-us/download/dotnet/9.0 | grep -i '<h3 id="sdk-9.*">SDK 9.*.*</h3>' | head -1 | awk -F\" '{print $3}' | awk '{print $2;}' | sed 's/<\/h3>//g')" \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh -i /usr/share -v $D_V \
&& ln -s /usr/share/dotnet /usr/bin/dotnet
# Install Wine and dependencies
RUN dpkg --add-architecture i386 \
&& apt update -y \
&& 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 --install-recommends winehq-stable \
&& 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 \
&& ln -s /usr/share/dotnet /usr/bin/dotnet \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
# Setup Wine environment for .NET installation
ENV WINEARCH=win64
ENV WINEPREFIX=/opt/wine
ENV DISPLAY=:99.0
ENV WINEDLLOVERRIDES="mscoree,mshtml="
# Initialize Wine and install .NET for Windows
RUN mkdir -p /tmp/.X11-unix && \
chmod 1777 /tmp/.X11-unix && \
(Xvfb :99 -screen 0 1024x768x16 -ac & ) && \
sleep 3 && \
timeout 60 wine wineboot --init || true && \
sleep 5 && \
cd /tmp && \
wget -q https://download.microsoft.com/download/6/6/1/661c9a9c-9c54-4f8b-b1c6-89d88c0f3d68/dotnet-runtime-9.0.6-win-x64.exe && \
timeout 180 wine dotnet-runtime-9.0.6-win-x64.exe /quiet /install || true && \
wget -q https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.301/dotnet-sdk-9.0.301-win-x64.exe && \
timeout 180 wine dotnet-sdk-9.0.301-win-x64.exe /quiet /install || true && \
rm -f *.exe && \
pkill Xvfb && \
chown -R container:container /opt/wine
USER container
ENV USER=container HOME=/home/container
# Wine environment variables
ENV WINEARCH=win64
ENV WINEPREFIX=/home/container/.wine
ENV DISPLAY=:99.0
ENV WINEDLLOVERRIDES="mscoree,mshtml="
# Copy the pre-configured Wine prefix to user directory
RUN cp -r /opt/wine /home/container/.wine \
&& chown -R container:container /home/container/.wine
WORKDIR /home/container
STOPSIGNAL SIGINT

View File

@@ -9,44 +9,10 @@ export INTERNAL_IP
export DOTNET_ROOT=/usr/share/
export SUBNAUTICA_INSTALLATION_PATH=/home/container/Subnautica
# Fix X11 permissions
mkdir -p /tmp/.X11-unix
chmod 1777 /tmp/.X11-unix
# Start Xvfb for Wine (virtual display)
Xvfb :99 -screen 0 1024x768x16 -ac &
export DISPLAY=:99.0
sleep 3
# Wine configuration
export WINEARCH=win64
export WINEPREFIX=/home/container/.wine
export WINEDLLOVERRIDES="mscoree,mshtml="
# Check if Wine prefix exists, if not copy from template
if [ ! -d "$WINEPREFIX" ]; then
echo "Wine prefix not found, this should not happen in Docker..."
# Fallback: reinitialize if needed
echo "Reinitializing Wine prefix..."
timeout 60 wine wineboot --init || echo "Wine initialization timed out"
sleep 5
fi
# Test if Wine works
echo "Testing Wine..."
if timeout 10 wine cmd /c "echo Wine works"; then
echo "Wine test successful"
else
echo "Wine test failed, but continuing..."
fi
# Print versions
printf "\033[1m\033[33mcontainer@pelican~ \033[0mdotnet --version\n"
dotnet --version
printf "\033[1m\033[33mcontainer@pelican~ \033[0mwine --version\n"
wine --version
# Replace Startup Variables
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e ":/home/container$ ${MODIFIED_STARTUP}"