From 4125545257a8207c5805aaab4c155073b7f0b5a4 Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Wed, 19 Jun 2019 00:01:58 +0300 Subject: [PATCH] Docker file --- .dockerignore | 20 +++++++++++++++++++ EventBot/Dockerfile | 18 +++++++++++++++++ EventBot/EventBot.csproj | 6 ++---- .../FolderProfile-linux-arm.pubxml | 16 +++++++++++++++ EventBot/Properties/launchSettings.json | 4 ++++ 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 EventBot/Dockerfile create mode 100644 EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2d15e48 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.vs +**/.vscode +**/*.*proj.user +**/azds.yaml +**/charts +**/bin +**/obj +**/Dockerfile +**/Dockerfile.develop +**/docker-compose.yml +**/docker-compose.*.yml +**/*.dbmdl +**/*.jfm +**/secrets.dev.yaml +**/values.dev.yaml +**/.toolstarget \ No newline at end of file diff --git a/EventBot/Dockerfile b/EventBot/Dockerfile new file mode 100644 index 0000000..d67b7e4 --- /dev/null +++ b/EventBot/Dockerfile @@ -0,0 +1,18 @@ +FROM mcr.microsoft.com/dotnet/core/runtime:2.2-stretch-slim AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build +WORKDIR /src +COPY ["EventBot/EventBot.csproj", "EventBot/"] +RUN dotnet restore "EventBot/EventBot.csproj" +COPY . . +WORKDIR "/src/EventBot" +RUN dotnet build "EventBot.csproj" -c Release -o /app + +FROM build AS publish +RUN dotnet publish "EventBot.csproj" -c Release -o /app + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "EventBot.dll"] \ No newline at end of file diff --git a/EventBot/EventBot.csproj b/EventBot/EventBot.csproj index 25ce4df..67da6ae 100644 --- a/EventBot/EventBot.csproj +++ b/EventBot/EventBot.csproj @@ -3,12 +3,9 @@ Exe netcoreapp2.2 + Linux - - - - @@ -20,6 +17,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml b/EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml new file mode 100644 index 0000000..3fc0995 --- /dev/null +++ b/EventBot/Properties/PublishProfiles/FolderProfile-linux-arm.pubxml @@ -0,0 +1,16 @@ + + + + + FileSystem + Release + Any CPU + netcoreapp2.2 + bin\Release\netcoreapp2.2\publish\linux-arm + linux-arm + true + <_IsPortable>false + + \ No newline at end of file diff --git a/EventBot/Properties/launchSettings.json b/EventBot/Properties/launchSettings.json index 9c63605..3dacec8 100644 --- a/EventBot/Properties/launchSettings.json +++ b/EventBot/Properties/launchSettings.json @@ -3,8 +3,12 @@ "EventBot": { "commandName": "Project", "environmentVariables": { + "dbconnection": "Server=localhost;Database=eventbot;User=root;Password=tux;", "token": "" } + }, + "Docker": { + "commandName": "Docker" } } } \ No newline at end of file