From 2c8bf95254b64d1e7118c2933ee692c2df5f01fb Mon Sep 17 00:00:00 2001 From: Alexander Konietzko Date: Thu, 9 Mar 2023 18:04:37 +0100 Subject: [PATCH] Add Docker support --- .dockerignore | 25 +++++++++++++++++++++++++ CleanArchitecture.Api/Dockerfile | 25 +++++++++++++++++++++++++ Todo.txt | 5 +---- 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 CleanArchitecture.Api/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.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 \ No newline at end of file diff --git a/CleanArchitecture.Api/Dockerfile b/CleanArchitecture.Api/Dockerfile new file mode 100644 index 0000000..eaa2fcf --- /dev/null +++ b/CleanArchitecture.Api/Dockerfile @@ -0,0 +1,25 @@ +#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/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["CleanArchitecture.Api/CleanArchitecture.Api.csproj", "CleanArchitecture.Api/"] +COPY ["CleanArchitecture.Application/CleanArchitecture.Application.csproj", "CleanArchitecture.Application/"] +COPY ["CleanArchitecture.Domain/CleanArchitecture.Domain.csproj", "CleanArchitecture.Domain/"] +COPY ["CleanArchitecture.Infrastructure/CleanArchitecture.Infrastructure.csproj", "CleanArchitecture.Infrastructure/"] +RUN dotnet restore "CleanArchitecture.Api/CleanArchitecture.Api.csproj" +COPY . . +WORKDIR "/src/CleanArchitecture.Api" +RUN dotnet build "CleanArchitecture.Api.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "CleanArchitecture.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "CleanArchitecture.Api.dll"] \ No newline at end of file diff --git a/Todo.txt b/Todo.txt index 6681ff1..4d40328 100644 --- a/Todo.txt +++ b/Todo.txt @@ -1,6 +1,3 @@ -- Complete user endpoints -- Add Tests - Remove warnings and apply suggestions -- Add Docker support - Add gRPC support -- Make repo public +- Add authentication and authorization