From 130093c31dfee618abbea485a739efabace146d2 Mon Sep 17 00:00:00 2001 From: "Ronny Carlansson (SparkVision)" Date: Sat, 27 Apr 2024 09:36:55 +0200 Subject: [PATCH] dockerized version --- .dockerignore | 30 ++++++++++++++++++++ src/ScmBackup/Dockerfile | 28 ++++++++++++++++++ src/ScmBackup/Properties/launchSettings.json | 10 +++++++ src/ScmBackup/ScmBackup.csproj | 3 ++ 4 files changed, 71 insertions(+) create mode 100644 .dockerignore create mode 100644 src/ScmBackup/Dockerfile create mode 100644 src/ScmBackup/Properties/launchSettings.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4d72b4f --- /dev/null +++ b/.dockerignore @@ -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/** \ No newline at end of file diff --git a/src/ScmBackup/Dockerfile b/src/ScmBackup/Dockerfile new file mode 100644 index 0000000..1df7f52 --- /dev/null +++ b/src/ScmBackup/Dockerfile @@ -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"] \ No newline at end of file diff --git a/src/ScmBackup/Properties/launchSettings.json b/src/ScmBackup/Properties/launchSettings.json new file mode 100644 index 0000000..e1247c0 --- /dev/null +++ b/src/ScmBackup/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "ScmBackup": { + "commandName": "Project" + }, + "Docker": { + "commandName": "Docker" + } + } +} \ No newline at end of file diff --git a/src/ScmBackup/ScmBackup.csproj b/src/ScmBackup/ScmBackup.csproj index ab2d312..088a920 100644 --- a/src/ScmBackup/ScmBackup.csproj +++ b/src/ScmBackup/ScmBackup.csproj @@ -14,6 +14,8 @@ false false false + Linux + ..\.. @@ -27,6 +29,7 @@ +