Enhance Dockerfile and entrypoint: update Wine installation process for improved security and add integration test script for Wine and .NET
This commit is contained in:
21
Dockerfile
21
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"]
|
@@ -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
|
||||
|
24
test-wine-dotnet.sh
Normal file
24
test-wine-dotnet.sh
Normal file
@@ -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!"
|
Reference in New Issue
Block a user