Files
dotnet-wine/entrypoint.sh

56 lines
1.4 KiB
Bash

#!/bin/bash
cd /home/container
# Set environment variable that holds the Internal Docker IP
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP
# DotNet environment setup
export DOTNET_ROOT=/usr/share/
# 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="
# Always reinitialize Wine prefix to ensure it works
echo "Reinitializing Wine prefix..."
rm -rf "$WINEPREFIX"
# Initialize Wine prefix with timeout to prevent hanging
echo "Creating Wine prefix..."
timeout 60 wine wineboot --init || echo "Wine initialization timed out, continuing..."
# Wait for Wine to settle
sleep 5
# 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}"
# Run the Server
eval ${MODIFIED_STARTUP}