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