Enhance Dockerfile: add logging for .NET SDK download, improve script for running .NET commands, and ensure Xvfb starts automatically in the shell
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -70,12 +70,15 @@ RUN Xvfb :99 -screen 0 1024x768x16 & \
|
|||||||
# Download and install .NET SDK with virtual display
|
# Download and install .NET SDK with virtual display
|
||||||
RUN cd /tmp \
|
RUN cd /tmp \
|
||||||
&& wget https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.301/dotnet-sdk-9.0.301-win-x64.exe \
|
&& wget https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.301/dotnet-sdk-9.0.301-win-x64.exe \
|
||||||
|
&& echo "Download completed, file size: $(ls -lh dotnet-sdk-9.0.301-win-x64.exe)" \
|
||||||
|
&& sleep 2 \
|
||||||
&& Xvfb :99 -screen 0 1024x768x16 & \
|
&& Xvfb :99 -screen 0 1024x768x16 & \
|
||||||
XVFB_PID=$! \
|
XVFB_PID=$! \
|
||||||
&& sleep 3 \
|
&& sleep 3 \
|
||||||
&& wine dotnet-sdk-9.0.301-win-x64.exe /quiet \
|
&& wine dotnet-sdk-9.0.301-win-x64.exe /quiet \
|
||||||
&& wineserver --wait \
|
&& wineserver --wait \
|
||||||
&& kill $XVFB_PID || true
|
&& kill $XVFB_PID || true \
|
||||||
|
&& rm dotnet-sdk-9.0.301-win-x64.exe || true
|
||||||
|
|
||||||
# Set environment variables for .NET
|
# Set environment variables for .NET
|
||||||
ENV DOTNET_ROOT="$WINEPREFIX/drive_c/Program Files/dotnet"
|
ENV DOTNET_ROOT="$WINEPREFIX/drive_c/Program Files/dotnet"
|
||||||
@@ -85,10 +88,29 @@ ENV PATH="$DOTNET_ROOT:$PATH"
|
|||||||
RUN Xvfb :99 -screen 0 1024x768x16 & \
|
RUN Xvfb :99 -screen 0 1024x768x16 & \
|
||||||
XVFB_PID=$! \
|
XVFB_PID=$! \
|
||||||
&& sleep 3 \
|
&& sleep 3 \
|
||||||
&& dotnet --version \
|
&& wine dotnet --version \
|
||||||
&& wineserver --wait \
|
&& wineserver --wait \
|
||||||
&& kill $XVFB_PID || true
|
&& kill $XVFB_PID || true
|
||||||
|
|
||||||
|
# Create a script to run .NET commands with virtual display
|
||||||
|
RUN echo '#!/bin/bash' > /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'export DISPLAY=:99' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'wine dotnet "$@"' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& chmod +x /home/wineuser/run-dotnet.sh
|
||||||
|
|
||||||
|
# Create dotnet alias and add to PATH
|
||||||
|
RUN echo 'alias dotnet="/home/wineuser/run-dotnet.sh"' >> /home/wineuser/.bashrc \
|
||||||
|
&& echo 'export PATH="/home/wineuser:$PATH"' >> /home/wineuser/.bashrc \
|
||||||
|
&& echo 'export DISPLAY=:99' >> /home/wineuser/.bashrc \
|
||||||
|
&& ln -s /home/wineuser/run-dotnet.sh /home/wineuser/dotnet
|
||||||
|
|
||||||
|
# Start Xvfb automatically when shell starts
|
||||||
|
RUN echo 'if ! pgrep Xvfb > /dev/null; then' >> /home/wineuser/.bashrc \
|
||||||
|
&& echo ' echo "Starting Xvfb display server..."' >> /home/wineuser/.bashrc \
|
||||||
|
&& echo ' Xvfb :99 -screen 0 1024x768x16 &' >> /home/wineuser/.bashrc \
|
||||||
|
&& echo ' sleep 2' >> /home/wineuser/.bashrc \
|
||||||
|
&& echo 'fi' >> /home/wineuser/.bashrc
|
||||||
|
|
||||||
# Set working directory for projects
|
# Set working directory for projects
|
||||||
WORKDIR /home/wineuser/projects
|
WORKDIR /home/wineuser/projects
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user