Enhance Dockerfile and README for Wine + .NET SDK setup
- Updated Dockerfile to include necessary X11 packages for Wine. - Improved initialization of Wine prefix with virtual display. - Modified .NET installation to utilize virtual display. - Updated README to reflect changes in usage instructions and removed PowerShell build instructions.
This commit is contained in:
34
Dockerfile
34
Dockerfile
@@ -4,7 +4,7 @@ FROM ubuntu:22.04
|
|||||||
# Avoid interactive prompts during installation
|
# Avoid interactive prompts during installation
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Update system and install necessary packages
|
# Update system and install necessary packages including X11 for Wine
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
wget \
|
wget \
|
||||||
@@ -12,6 +12,10 @@ RUN apt-get update && apt-get install -y \
|
|||||||
gnupg2 \
|
gnupg2 \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
|
xvfb \
|
||||||
|
x11-utils \
|
||||||
|
x11-xserver-utils \
|
||||||
|
dbus-x11 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Add Wine repository and install Wine 64-bit
|
# Add Wine repository and install Wine 64-bit
|
||||||
@@ -28,25 +32,41 @@ RUN useradd -m -s /bin/bash wineuser
|
|||||||
USER wineuser
|
USER wineuser
|
||||||
WORKDIR /home/wineuser
|
WORKDIR /home/wineuser
|
||||||
|
|
||||||
# Initialize Wine prefix
|
|
||||||
RUN winecfg /v
|
|
||||||
|
|
||||||
# Set Wine to 64-bit mode
|
# Set Wine to 64-bit mode
|
||||||
ENV WINEARCH=win64
|
ENV WINEARCH=win64
|
||||||
ENV WINEPREFIX=/home/wineuser/.wine
|
ENV WINEPREFIX=/home/wineuser/.wine
|
||||||
|
ENV DISPLAY=:99
|
||||||
|
|
||||||
# Download and install .NET SDK
|
# Initialize Wine prefix with virtual display
|
||||||
|
RUN Xvfb :99 -screen 0 1024x768x16 & \
|
||||||
|
sleep 2 && \
|
||||||
|
winecfg -v && \
|
||||||
|
pkill Xvfb
|
||||||
|
|
||||||
|
# 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 \
|
||||||
&& wine dotnet-sdk-9.0.301-win-x64.exe /quiet /install \
|
&& Xvfb :99 -screen 0 1024x768x16 & \
|
||||||
|
&& sleep 2 \
|
||||||
|
&& wine dotnet-sdk-9.0.301-win-x64.exe /S /v/qn \
|
||||||
|
&& pkill Xvfb \
|
||||||
&& rm dotnet-sdk-9.0.301-win-x64.exe
|
&& rm dotnet-sdk-9.0.301-win-x64.exe
|
||||||
|
|
||||||
# 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"
|
||||||
ENV PATH="$DOTNET_ROOT:$PATH"
|
ENV PATH="$DOTNET_ROOT:$PATH"
|
||||||
|
|
||||||
|
# Create a script to run .NET commands with virtual display
|
||||||
|
RUN echo '#!/bin/bash' > /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'Xvfb :99 -screen 0 1024x768x16 & XVFB_PID=$!' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'sleep 2' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'export DISPLAY=:99' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'wine dotnet "$@"' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& echo 'kill $XVFB_PID' >> /home/wineuser/run-dotnet.sh \
|
||||||
|
&& chmod +x /home/wineuser/run-dotnet.sh
|
||||||
|
|
||||||
# Verify installation
|
# Verify installation
|
||||||
RUN wine dotnet --version
|
RUN /home/wineuser/run-dotnet.sh --version
|
||||||
|
|
||||||
# Set working directory for projects
|
# Set working directory for projects
|
||||||
WORKDIR /home/wineuser/projects
|
WORKDIR /home/wineuser/projects
|
||||||
|
28
README.md
28
README.md
@@ -10,11 +10,6 @@ Ez a Docker image telepíti a Wine 64-bit verzióját és a Microsoft .NET SDK 9
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
### Windows PowerShell-lel:
|
|
||||||
```powershell
|
|
||||||
.\build.ps1
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bash-sel (Git Bash, WSL, Linux, macOS):
|
### Bash-sel (Git Bash, WSL, Linux, macOS):
|
||||||
```bash
|
```bash
|
||||||
chmod +x build.sh
|
chmod +x build.sh
|
||||||
@@ -45,26 +40,37 @@ docker run -it --rm -v ${PWD}/projects:/home/wineuser/projects wine-dotnet:lates
|
|||||||
|
|
||||||
## .NET használata a containerben
|
## .NET használata a containerben
|
||||||
|
|
||||||
A containerben belül használhatod a .NET SDK-t:
|
A containerben belül használhatod a .NET SDK-t a speciális script segítségével:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# .NET verzió ellenőrzése
|
# .NET verzió ellenőrzése
|
||||||
wine dotnet --version
|
./run-dotnet.sh --version
|
||||||
|
|
||||||
# Új projekt létrehozása
|
# Új projekt létrehozása
|
||||||
wine dotnet new console -n MyApp
|
./run-dotnet.sh new console -n MyApp
|
||||||
|
|
||||||
# Projekt build-elése
|
# Projekt build-elése
|
||||||
cd MyApp
|
cd MyApp
|
||||||
wine dotnet build
|
../run-dotnet.sh build
|
||||||
|
|
||||||
# Projekt futtatása
|
# Projekt futtatása
|
||||||
wine dotnet run
|
../run-dotnet.sh run
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatívaként közvetlenül is használhatod:
|
||||||
|
```bash
|
||||||
|
# Virtual display indítása
|
||||||
|
Xvfb :99 -screen 0 1024x768x16 &
|
||||||
|
export DISPLAY=:99
|
||||||
|
|
||||||
|
# .NET parancsok
|
||||||
|
wine dotnet --version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Megjegyzések
|
## Megjegyzések
|
||||||
|
|
||||||
- A container egy `wineuser` felhasználóval fut (nem root)
|
- A container egy `wineuser` felhasználóval fut (nem root)
|
||||||
- A Wine prefix előre konfigurálva van 64-bit módban
|
- A Wine prefix előre konfigurálva van 64-bit módban
|
||||||
- A .NET SDK csendben telepítve van
|
- A .NET SDK csendben telepítve van virtual display segítségével
|
||||||
- A projektek a `/home/wineuser/projects` könyvtárban tárolhatók
|
- A projektek a `/home/wineuser/projects` könyvtárban tárolhatók
|
||||||
|
- A `run-dotnet.sh` script automatikusan kezeli a virtual display-t
|
||||||
|
Reference in New Issue
Block a user