From 3737ac3e93e2cea5229e72bf622bf86bc6fdcf60 Mon Sep 17 00:00:00 2001 From: Xander Sigler Date: Wed, 26 Jan 2022 21:09:51 -0800 Subject: [PATCH] Added docker file to create container and drone.yml for CI --- AOC2021.Test/Models/Answer.cs | 1 - AOC2021.sln | 2 +- AOC2021/.drone.yml | 24 ++++++++++++++++++++++++ AOC2021/AOC2021.csproj.user | 1 + AOC2021/Dockerfile | 18 ++++++++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 AOC2021/.drone.yml create mode 100644 AOC2021/Dockerfile diff --git a/AOC2021.Test/Models/Answer.cs b/AOC2021.Test/Models/Answer.cs index 4f48892..8090011 100644 --- a/AOC2021.Test/Models/Answer.cs +++ b/AOC2021.Test/Models/Answer.cs @@ -4,7 +4,6 @@ namespace AOC2021.Test.Models { public class Answer { - public string Day_A_Test { get; set; } public string Day_A_Input { get; set; } public string Day_B_Test { get; set; } diff --git a/AOC2021.sln b/AOC2021.sln index 1df8881..41c3a8f 100644 --- a/AOC2021.sln +++ b/AOC2021.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.31515.178 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AOC2021", "AOC2021\AOC2021.csproj", "{1C97C7BD-E112-4CC4-B870-BCEE6146C707}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AOC2021.Test", "AOC2021.Test\AOC2021.Test.csproj", "{00B6E578-8E4E-4722-A601-A8CEE90704E1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AOC2021.Test", "AOC2021.Test\AOC2021.Test.csproj", "{00B6E578-8E4E-4722-A601-A8CEE90704E1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/AOC2021/.drone.yml b/AOC2021/.drone.yml new file mode 100644 index 0000000..d6a9dfb --- /dev/null +++ b/AOC2021/.drone.yml @@ -0,0 +1,24 @@ +kind: pipeline +type: docker +name: AOC2021 + +steps: +- name: init + image: busybox + commands: + - echo 'Starting build pipeline for AOC2021' + +- name: build-aoc-2021 + image: plugins/docker + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: 97waterpolo/aoc-2021 + dockerfile: AOC2021/Dockerfile + +- name: finish + image: busybox + commands: + - echo 'Finished deployment for Aincrad' \ No newline at end of file diff --git a/AOC2021/AOC2021.csproj.user b/AOC2021/AOC2021.csproj.user index 19372ed..45ebd33 100644 --- a/AOC2021/AOC2021.csproj.user +++ b/AOC2021/AOC2021.csproj.user @@ -5,5 +5,6 @@ AOC2021 + false \ No newline at end of file diff --git a/AOC2021/Dockerfile b/AOC2021/Dockerfile new file mode 100644 index 0000000..229a2cb --- /dev/null +++ b/AOC2021/Dockerfile @@ -0,0 +1,18 @@ +FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["AOC2021.csproj", "AOC2021/"] +RUN dotnet restore "AOC2021/AOC2021.csproj" +COPY [".", "AOC2021/."] +WORKDIR "/src/AOC2021" +RUN dotnet build "AOC2021.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "AOC2021.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "AOC2021.dll"] \ No newline at end of file