From f643c057952703bfcda4644b57ce0130c40fce86 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sun, 7 Jun 2020 04:25:41 +0300 Subject: [PATCH] docker support --- .dockerignore | 25 +++++++++++++++++++++++++ Chatbot.Api/Chatbot.Api.csproj | 1 + Chatbot.Api/Dockerfile | 30 ++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 .dockerignore create mode 100644 Chatbot.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/Chatbot.Api/Chatbot.Api.csproj b/Chatbot.Api/Chatbot.Api.csproj index e4359f3..b904b3b 100644 --- a/Chatbot.Api/Chatbot.Api.csproj +++ b/Chatbot.Api/Chatbot.Api.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + Linux diff --git a/Chatbot.Api/Dockerfile b/Chatbot.Api/Dockerfile new file mode 100644 index 0000000..ff744b5 --- /dev/null +++ b/Chatbot.Api/Dockerfile @@ -0,0 +1,30 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build +WORKDIR /src +COPY dependencies.props . +COPY Directory.Build.props . +COPY ["Chatbot.Api/Chatbot.Api.csproj", "Chatbot.Api/"] +COPY ["Chatbot.Api.Domain.Data/Chatbot.Api.Domain.Data.csproj", "Chatbot.Api.Domain.Data/"] +COPY ["Chatbot.Api.Domain/Chatbot.Api.Domain.csproj", "Chatbot.Api.Domain/"] +COPY ["Chatbot.Api.Application/Chatbot.Api.Application.csproj", "Chatbot.Api.Application/"] +RUN dotnet restore "Chatbot.Api/Chatbot.Api.csproj" +COPY . . +WORKDIR "/src/Chatbot.Api" +RUN dotnet build "Chatbot.Api.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Chatbot.Api.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENV urls="http://*:80" +ENV ConnectionStrings__DatabaseConnection="Server=alpine-docker;Database=ReverseProxy_Chatbot;User Id=sa;Password=VN94STAsta!2;MultipleActiveResultSets=true" + +ENTRYPOINT ["dotnet", "Chatbot.Api.dll", "--docker"] \ No newline at end of file