From 0fadf3bc21ff570bec80c5570d66b77ce03fb98f Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 30 Oct 2020 19:16:06 -0600 Subject: [PATCH] add drone and docker files --- .dockerignore | 2 ++ OFBButte.sln | 19 +++++++++++++------ dockerfile | 16 ++++++++++++++++ drone.yml | 19 +++++++++++++++++++ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 .dockerignore create mode 100644 dockerfile create mode 100644 drone.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cbbd0b5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +bin/ +obj/ \ No newline at end of file diff --git a/OFBButte.sln b/OFBButte.sln index 003b3f5..b0eb463 100644 --- a/OFBButte.sln +++ b/OFBButte.sln @@ -3,17 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29102.190 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Api", "OFBButte.Api\OFBButte.Api.csproj", "{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Api", "OFBButte.Api\OFBButte.Api.csproj", "{FF5F4D78-6419-47E4-A7CE-5B25503BE2D7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Application", "OFBButte.Application\OFBButte.Application.csproj", "{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Application", "OFBButte.Application\OFBButte.Application.csproj", "{8BCA31C6-C10D-4865-BAE8-6DC932B4797D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Console", "OFBButte.Console\OFBButte.Console.csproj", "{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Console", "OFBButte.Console\OFBButte.Console.csproj", "{82FA36EC-1CBC-4F9A-B436-A61D9AA6D1C7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Database", "OFBButte.Database\OFBButte.Database.csproj", "{64A05F44-4BB2-45CE-A343-6307EA8F099A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Database", "OFBButte.Database\OFBButte.Database.csproj", "{64A05F44-4BB2-45CE-A343-6307EA8F099A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Infrastructure", "OFBButte.Infrastructure\OFBButte.Infrastructure.csproj", "{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Infrastructure", "OFBButte.Infrastructure\OFBButte.Infrastructure.csproj", "{157A1CB3-9320-4FE6-ABC5-1C9EF1952540}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OFBButte.Entities", "OFBButte.Entities\OFBButte.Entities.csproj", "{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OFBButte.Entities", "OFBButte.Entities\OFBButte.Entities.csproj", "{39A5BAF9-E108-4B81-8DBB-A7C1A6CEA9EF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{94EB31EF-5894-4F6C-96B8-FA23DB42B2B4}" + ProjectSection(SolutionItems) = preProject + .dockerignore = .dockerignore + dockerfile = dockerfile + drone.yml = drone.yml + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..eacaea1 --- /dev/null +++ b/dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env +WORKDIR /app + +# Copy csproj and restore as distinct layers +COPY *.csproj ./ +RUN dotnet restore + +# Copy everything else and build +COPY . ./ +RUN dotnet publish -c Release -o out + +# Build runtime image +FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "aspnetapp.dll 8222"] \ No newline at end of file diff --git a/drone.yml b/drone.yml new file mode 100644 index 0000000..6bdbb87 --- /dev/null +++ b/drone.yml @@ -0,0 +1,19 @@ +kind: pipeline +type: docker +name: default +steps: +- name: node + image: docker + volumes: + - name: docker_sock + path: /var/run/docker.sock + commands: + - docker build --tag ofb_api . + - docker rm -f ofb_api || true + - docker run --name ofb_api --restart always -d -p "8222:8222" ofb_api + + +volumes: + - name: docker_sock + host: + path: /var/run/docker.sock \ No newline at end of file