diff --git a/.drone.yml b/.drone.yml index f472699..ed77613 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,11 +1,11 @@ kind: pipeline type: docker -name: EfCore_Lol_S4 +name: EfCore_Lol_S4 trigger: event: - push - + steps: - name: build @@ -42,20 +42,30 @@ steps: # accessible en ligne de commande par $${PLUGIN_SONAR_TOKEN} sonar_token: from_secret: SECRET_SONAR_LOGIN - depends on: [tests] + depends_on: [tests] # docker image build -# - name: docker-build-and-push -# image: plugins/docker - # settings: - # dockerfile: Dockerfile - # context: WebApiLol - # registry: hub.codefirst.iut.uca.fr - # repo: hub.codefirst.iut.uca.fr/maxence.lanone/EfCore_LoL_S4 - # username: - # from_secret: SECRET_REGISTRY_USERNAME - # password: - # from_secret: SECRET_REGISTRY_PASSWORD + - name: docker-build + image: plugins/docker + settings: + dockerfile: Sources/WebApiLol/Dockerfile + context: Sources/ + registry: hub.codefirst.iut.uca.fr + repo: hub.codefirst.iut.uca.fr/maxence.lanone/efcore_lol_s4 + username: + from_secret: SECRET_REGISTRY_USERNAME + password: + from_secret: SECRET_REGISTRY_PASSWORD + + # container deployment + - name: deploy-container + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environment: + IMAGENAME: hub.codefirst.iut.uca.fr/maxence.lanone/efcore_lol_s4:latest + CONTAINERNAME: maxencelanone-leagueoflegendsapi + COMMAND: create + OVERWRITE: true + depends_on: [ docker-build ] volumes: - name: docs diff --git a/Sources/.dockerignore b/Sources/.dockerignore new file mode 100644 index 0000000..bdca33b --- /dev/null +++ b/Sources/.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/Sources/LeagueOfLegends.sln b/Sources/LeagueOfLegends.sln index 4ddf591..d8877d5 100644 --- a/Sources/LeagueOfLegends.sln +++ b/Sources/LeagueOfLegends.sln @@ -26,11 +26,10 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApiLol", "WebApiLol\WebApiLol.csproj", "{DAE3B5A2-8904-43AE-8459-ED64C3366FDF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{73142960-0D40-4766-973B-37094F4BD879}" - ProjectSection(SolutionItems) = preProject - Dockerfile = Dockerfile - EndProjectSection EndProject -Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "ConsoleTestapi", "Tests\ConsoleTestapi\ConsoleTestapi.csproj", "{EA884D64-6425-46FB-BA25-E2EB8FE6BECE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTestapi", "Tests\ConsoleTestapi\ConsoleTestapi.csproj", "{EA884D64-6425-46FB-BA25-E2EB8FE6BECE}" +EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{1B81A541-7D10-4603-B5A2-94108954D831}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -78,6 +77,10 @@ Global {EA884D64-6425-46FB-BA25-E2EB8FE6BECE}.Debug|Any CPU.Build.0 = Debug|Any CPU {EA884D64-6425-46FB-BA25-E2EB8FE6BECE}.Release|Any CPU.ActiveCfg = Release|Any CPU {EA884D64-6425-46FB-BA25-E2EB8FE6BECE}.Release|Any CPU.Build.0 = Release|Any CPU + {1B81A541-7D10-4603-B5A2-94108954D831}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B81A541-7D10-4603-B5A2-94108954D831}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B81A541-7D10-4603-B5A2-94108954D831}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B81A541-7D10-4603-B5A2-94108954D831}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Sources/WebApiLol/Dockerfile b/Sources/WebApiLol/Dockerfile new file mode 100644 index 0000000..ad383f4 --- /dev/null +++ b/Sources/WebApiLol/Dockerfile @@ -0,0 +1,25 @@ +#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/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["WebApiLol/WebApiLol.csproj", "WebApiLol/"] +COPY ["Model/Model.csproj", "Model/"] +COPY ["Shared/Shared.csproj", "Shared/"] +COPY ["StubLib/StubLib.csproj", "StubLib/"] +RUN dotnet restore "WebApiLol/WebApiLol.csproj" +COPY . . +WORKDIR "/src/WebApiLol" +RUN dotnet build "WebApiLol.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "WebApiLol.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "WebApiLol.dll"] diff --git a/Sources/docker-compose.dcproj b/Sources/docker-compose.dcproj new file mode 100644 index 0000000..a65784f --- /dev/null +++ b/Sources/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + {1B81A541-7D10-4603-B5A2-94108954D831} + True + {Scheme}://localhost:{ServicePort}/swagger + webapilol + + + + docker-compose.yml + + + + + diff --git a/Sources/docker-compose.override.yml b/Sources/docker-compose.override.yml new file mode 100644 index 0000000..02a4c75 --- /dev/null +++ b/Sources/docker-compose.override.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + webapilol: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=https://+:443;http://+:80 + ports: + - "80" + - "443" + volumes: + - ~/.aspnet/https:/root/.aspnet/https:ro + - ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro \ No newline at end of file diff --git a/Sources/docker-compose.yml b/Sources/docker-compose.yml new file mode 100644 index 0000000..80abb88 --- /dev/null +++ b/Sources/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.4' + +services: + webapilol: + image: ${DOCKER_REGISTRY-}webapilol + build: + context: . + dockerfile: WebApiLol/Dockerfile