Created
June 19, 2017 17:41
-
-
Save ninjarobot/dcbfecc1616d42537ef354f908bb6c93 to your computer and use it in GitHub Desktop.
A minimal Alpine image using a self-contained .NET executable built with mkbundle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
RUN echo 'using System; \ | |
namespace Program { \ | |
public class MyClass { \ | |
public static void Main(string[] args) { \ | |
Console.WriteLine ("Hello from C#"); \ | |
} \ | |
} \ | |
}' >> Program.cs | |
RUN apk add --virtual build-dependencies --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing --no-cache mono mono-dev musl-dev binutils gcc && \ | |
csc Program.cs && \ | |
mkbundle --deps --static --config /etc/mono/config -L /usr/lib/mono/4.5 -o program Program.exe /usr/lib/mono/4.5/mscorlib.dll /usr/lib/mono/4.5/System.dll && \ | |
apk del build-dependencies && \ | |
apk add --no-cache libgcc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment