From 9051c0fcdbfe5f740722537d2cfd63de74bca86d Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Mon, 18 Aug 2025 12:45:20 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feat:=20Add=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding AutoDoc dockerfile --- .dockerignore | 30 ++++++++++++++++++++++++++++++ AutoDoc.csproj | 3 +++ Dockerfile | 25 +++++++++++++++++++++++++ Properties/launchSettings.json | 10 ++++++++++ 4 files changed, 68 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Properties/launchSettings.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fe1152b --- /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/AutoDoc.csproj b/AutoDoc.csproj index 79c99de..216771f 100644 --- a/AutoDoc.csproj +++ b/AutoDoc.csproj @@ -5,6 +5,8 @@ net9.0 enable enable + Linux + . @@ -27,6 +29,7 @@ + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1cfc9e4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# This phase is used when running in VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base +USER $APP_UID +WORKDIR /app + +# This phase is used to compile the service project +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["AutoDoc.csproj", "."] +RUN dotnet restore "./AutoDoc.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "./AutoDoc.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# This phase is used to publish the service project to be copied to the final phase +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./AutoDoc.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# This phase is used in production or when running in VS in normal mode (default when not using Debug configuration) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "AutoDoc.dll"] \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..70b98c2 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "AutoDoc": { + "commandName": "Project" + }, + "Container (Dockerfile)": { + "commandName": "Docker" + } + } +} \ No newline at end of file