Skip to content

Commit

Permalink
Merge pull request #78 from lessismore-sparkvision/dockerized-net8
Browse files Browse the repository at this point in the history
Dockerized net8
  • Loading branch information
christianspecht committed Jun 5, 2024
2 parents 1002aff + 130093c commit 4d13e93
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
28 changes: 28 additions & 0 deletions src/ScmBackup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
USER app
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/ScmBackup/ScmBackup.csproj", "src/ScmBackup/"]
RUN dotnet restore "./src/ScmBackup/./ScmBackup.csproj"
COPY . .
WORKDIR "/src/src/ScmBackup"
RUN dotnet build "./ScmBackup.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ScmBackup.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

USER root
RUN apt-get update && apt-get install -y git
USER app

ENTRYPOINT ["dotnet", "ScmBackup.dll"]
10 changes: 10 additions & 0 deletions src/ScmBackup/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"profiles": {
"ScmBackup": {
"commandName": "Project"
},
"Docker": {
"commandName": "Docker"
}
}
}
3 changes: 3 additions & 0 deletions src/ScmBackup/ScmBackup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,6 +29,7 @@

<ItemGroup>
<PackageReference Include="MailKit" Version="4.5.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="Octokit" Version="11.0.1" />
Expand Down

0 comments on commit 4d13e93

Please sign in to comment.