Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usage samples #6

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions samples/NetCore/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# escape=`

# BUILDER
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY src/ ./
RUN dotnet restore ConsoleApp/ConsoleApp.csproj
RUN dotnet publish ConsoleApp/ConsoleApp.csproj -c Release -o /out

# TOOLS
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS tools
ENV PATH="/root/.dotnet/tools:${PATH}"
RUN dotnet tool install -g EMG.Tools.EnsureUnique

# RUNNER
FROM mcr.microsoft.com/dotnet/core/runtime:3.1 AS runtime
WORKDIR /app
COPY --from=tools /root/.dotnet/tools/ /opt/bin
COPY --from=build /out .
ENV PATH="/opt/bin:${PATH}" `
DotNetEnsureUnique__S3__BucketName= `
DotNetEnsureUnique__S3__FilePrefix=
ENTRYPOINT dotnet-ensure-unique exe ./ConsoleApp
39 changes: 39 additions & 0 deletions samples/NetCore/NetCore.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{116B4950-3300-47B4-A4F2-533CA24D966F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "src\ConsoleApp\ConsoleApp.csproj", "{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Debug|x64.ActiveCfg = Debug|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Debug|x64.Build.0 = Debug|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Debug|x86.ActiveCfg = Debug|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Debug|x86.Build.0 = Debug|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Release|Any CPU.Build.0 = Release|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Release|x64.ActiveCfg = Release|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Release|x64.Build.0 = Release|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Release|x86.ActiveCfg = Release|Any CPU
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FA79C93C-D5A6-4FC3-969D-09A05E50AE8A} = {116B4950-3300-47B4-A4F2-533CA24D966F}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions samples/NetCore/src/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
17 changes: 17 additions & 0 deletions samples/NetCore/src/ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Threading.Tasks;

namespace ConsoleApp
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Loading...");

await Task.Delay(TimeSpan.FromSeconds(10));

Console.WriteLine("Bye!");
}
}
}
45 changes: 45 additions & 0 deletions samples/NetFx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# escape=`

# BUILDER
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 as build
WORKDIR /src
COPY src/ ./
RUN dotnet restore ConsoleApp/ConsoleApp.csproj
RUN dotnet publish ConsoleApp/ConsoleApp.csproj -c Release -o /out

# Option 1
# TOOLS
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 as tools
RUN dotnet tool install EMG.Tools.EnsureUnique --tool-path C:\tools

# RUNNER -- Shared 5.27 GB -- unique 113 MB
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8 AS runtime
ADD https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.ps1 C:\temp\
RUN powershell C:\temp\dotnet-install.ps1 -Channel LTS -Runtime dotnet -InstallDir C:\dotnet
ARG DOTNET_PATH=C:\dotnet\
ARG DOTNET_TOOLS_PATH=C:\tools\
RUN SETX DOTNET_ROOT %DOTNET_PATH%
RUN SETX PATH %PATH%;%DOTNET_PATH%;%DOTNET_TOOLS_PATH%
ENV DotNetEnsureUnique__S3__BucketName= `
DotNetEnsureUnique__S3__FilePrefix= `
DOTNET_CLI_TELEMETRY_OPTOUT=1
COPY --from=tools C:\tools\ C:\tools\
WORKDIR /app
COPY --from=build /out .
ENTRYPOINT ["dotnet-ensure-unique", "exe", "ConsoleApp.exe"]

# Option 2
# # RUNNER
# FROM mcr.microsoft.com/dotnet/framework/runtime:4.8 AS runtime
# ADD https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.ps1 C:\temp\
# ARG DOTNET_PATH=C:\dotnet\
# RUN powershell C:\temp\dotnet-install.ps1 -Channel LTS -InstallDir %DOTNET_PATH%
# RUN SETX DOTNET_ROOT %DOTNET_PATH%
# RUN SETX PATH %PATH%;%DOTNET_PATH%
# ENV DotNetEnsureUnique__S3__BucketName= `
# DotNetEnsureUnique__S3__FilePrefix= `
# DOTNET_CLI_TELEMETRY_OPTOUT=1
# RUN dotnet tool install -g EMG.Tools.EnsureUnique
# WORKDIR /app
# COPY --from=build /out .
# ENTRYPOINT ["dotnet", "ensure-unique", "exe", "ConsoleApp.exe"]
39 changes: 39 additions & 0 deletions samples/NetFx/NetFx.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{83044FA3-B259-483F-BAA0-E2134E96BA9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "src\ConsoleApp\ConsoleApp.csproj", "{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Debug|x64.ActiveCfg = Debug|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Debug|x64.Build.0 = Debug|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Debug|x86.ActiveCfg = Debug|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Debug|x86.Build.0 = Debug|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Release|Any CPU.Build.0 = Release|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Release|x64.ActiveCfg = Release|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Release|x64.Build.0 = Release|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Release|x86.ActiveCfg = Release|Any CPU
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5BF52843-F63E-4A48-B9C1-2616CE4D5AF0} = {83044FA3-B259-483F-BAA0-E2134E96BA9C}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions samples/NetFx/src/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>

</Project>
17 changes: 17 additions & 0 deletions samples/NetFx/src/ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Threading.Tasks;

namespace ConsoleApp
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Loading...");

await Task.Delay(TimeSpan.FromSeconds(10));

Console.WriteLine("Bye!");
}
}
}