Skip to content

Instantly share code, notes, and snippets.

@whtiehack
Forked from jensmeder/Dockerfile
Created April 7, 2023 11:29
Show Gist options
  • Save whtiehack/36f643c19f9a4020b3b5c4570cdb9af9 to your computer and use it in GitHub Desktop.
Save whtiehack/36f643c19f9a4020b3b5c4570cdb9af9 to your computer and use it in GitHub Desktop.
Hello World Example For .NET 4.5.2 Running With Wine in Ubuntu Docker Container
FROM ubuntu:18.04
# Install wget
RUN apt-get update
RUN apt-get install -y wget
# Add 32-bit architecture
RUN dpkg --add-architecture i386
RUN apt-get update
# Install Wine
RUN apt-get install -y software-properties-common gnupg2
RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key
RUN apt-key add winehq.key
RUN apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
RUN apt-get install -y --install-recommends winehq-stable winbind
# Turn off Fixme warnings
ENV WINEDEBUG=fixme-all
# Setup a Wine prefix
ENV WINEPREFIX=/root/.net
ENV WINEARCH=win64
RUN winecfg
# Install Winetricks
RUN apt-get install -y cabextract
RUN wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
RUN chmod +x winetricks
RUN cp winetricks /usr/local/bin
# Install .NET Framework 4.5.2
RUN wineboot -u && winetricks -q dotnet452
# Compile HelloWorld.cs
COPY HelloWorld.cs /root/.net/drive_c/HelloWorld.cs
WORKDIR /root/.net/drive_c/
RUN wine /root/.net/drive_c/windows/Microsoft.NET/Framework64/v4.0.30319/csc.exe HelloWorld.cs
# Run HelloWorld.exe
ENTRYPOINT ["wine", "HelloWorld.exe"]
using System;
namespace HelloWorld {
class Program {
static void Main(string[] args) {
Console.WriteLine("\n\n Hello World!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment