diff --git a/CetteAppliVaMarcher/.dockerignore b/CetteAppliVaMarcher/.dockerignore new file mode 100644 index 0000000..bdca33b --- /dev/null +++ b/CetteAppliVaMarcher/.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/CetteAppliVaMarcher/.drone.yml b/CetteAppliVaMarcher/.drone.yml new file mode 100644 index 0000000..666f51d --- /dev/null +++ b/CetteAppliVaMarcher/.drone.yml @@ -0,0 +1,72 @@ +kind: pipeline +type: docker +name: default + +trigger: + event: + - push + +steps: + - name: build + image: mcr.microsoft.com/dotnet/sdk:6.0 + commands: + - cd Sources/ + - dotnet restore MySolution.sln + - dotnet build MySolution.sln -c Release --no-restore + - name: tests + image: mcr.microsoft.com/dotnet/sdk:6.0 + commands: + - cd Sources/ + - dotnet restore MySolution.sln + - dotnet test MySolution.sln --no-restore + depends_on: [build] + - name: code-analysis + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6 + commands: + - cd Sources/ + - dotnet restore MySolution.sln + - dotnet sonarscanner begin /k:$REPO_NAME /d:sonar.host.url=$$$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Tests/**" /d:sonar.login=$$$${PLUGIN_SONAR_TOKEN} + - dotnet build MySolution.sln -c Release --no-restore + - dotnet test MySolution.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" + - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" + - dotnet publish MySolution.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release + - dotnet sonarscanner end /d:sonar.login=$$$${PLUGIN_SONAR_TOKEN} + secrets: [ SECRET_SONAR_LOGIN ] + settings: + # accessible en ligne de commande par $${PLUGIN_SONAR_HOST} + sonar_host: https://codefirst.iut.uca.fr/sonar/ + # accessible en ligne de commande par $${PLUGIN_SONAR_TOKEN} + sonar_token: + from_secret: SECRET_SONAR_LOGIN + depends_on: [tests] + - name: generate-and-deploy-docs + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer + failure: ignore + volumes: + - name: docs + path: /docs + commands: + - /entrypoint.sh + when: + branch: + - master + depends_on: [ build ] + - name: docker-build + image: plugins/docker + settings: + dockerfile: Sources/Dockerfile + context: . + registry: hub.codefirst.iut.uca.fr + repo: hub.codefirst.iut.uca.fr/git/paul.squizzato/MonAppliBlazorCool + username: + from_secret: SECRET_REGISTRY_USERNAME + password: + from_secret: SECRET_REGISTRY_PASSWORD + when: + branch: + - master + +# The volumes declaration appear at the end of the file, after all steps +volumes: +- name: docs + temp: {} \ No newline at end of file diff --git a/CetteAppliVaMarcher/CetteAppliVaMarcher.sln b/CetteAppliVaMarcher/CetteAppliVaMarcher.sln index 8cae98d..646f5eb 100644 --- a/CetteAppliVaMarcher/CetteAppliVaMarcher.sln +++ b/CetteAppliVaMarcher/CetteAppliVaMarcher.sln @@ -5,6 +5,11 @@ VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CetteAppliVaMarcher", "CetteAppliVaMarcher\CetteAppliVaMarcher.csproj", "{A9F6F3DE-16A6-4356-9CBA-4EB93FAC4A3D}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Éléments de solution", "Éléments de solution", "{E3E489F9-414F-42CF-8B42-192E6F5F51AB}" + ProjectSection(SolutionItems) = preProject + .drone.yml = .drone.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/CetteAppliVaMarcher/CetteAppliVaMarcher/CetteAppliVaMarcher.csproj b/CetteAppliVaMarcher/CetteAppliVaMarcher/CetteAppliVaMarcher.csproj index 0a8a8c3..3cbed9f 100644 --- a/CetteAppliVaMarcher/CetteAppliVaMarcher/CetteAppliVaMarcher.csproj +++ b/CetteAppliVaMarcher/CetteAppliVaMarcher/CetteAppliVaMarcher.csproj @@ -4,6 +4,8 @@ net6.0 enable enable + c81bea12-bad2-4bc8-ac16-4426f9d8d643 + Linux @@ -13,6 +15,7 @@ + diff --git a/CetteAppliVaMarcher/CetteAppliVaMarcher/Dockerfile b/CetteAppliVaMarcher/CetteAppliVaMarcher/Dockerfile new file mode 100644 index 0000000..0b0bf02 --- /dev/null +++ b/CetteAppliVaMarcher/CetteAppliVaMarcher/Dockerfile @@ -0,0 +1,23 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["nuget.config", "."] +COPY ["CetteAppliVaMarcher/CetteAppliVaMarcher.csproj", "CetteAppliVaMarcher/"] +RUN dotnet restore "CetteAppliVaMarcher/CetteAppliVaMarcher.csproj" +COPY . . +WORKDIR "/src/CetteAppliVaMarcher" +RUN dotnet build "CetteAppliVaMarcher.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "CetteAppliVaMarcher.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "CetteAppliVaMarcher.dll"] \ No newline at end of file diff --git a/CetteAppliVaMarcher/CetteAppliVaMarcher/Properties/launchSettings.json b/CetteAppliVaMarcher/CetteAppliVaMarcher/Properties/launchSettings.json index 1cebbba..ca5cc67 100644 --- a/CetteAppliVaMarcher/CetteAppliVaMarcher/Properties/launchSettings.json +++ b/CetteAppliVaMarcher/CetteAppliVaMarcher/Properties/launchSettings.json @@ -10,12 +10,12 @@ "profiles": { "CetteAppliVaMarcher": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:7120;http://localhost:5120", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "https://localhost:7120;http://localhost:5120", + "dotnetRunMessages": true }, "IIS Express": { "commandName": "IISExpress", @@ -23,6 +23,13 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true, + "useSSL": true } } -} +} \ No newline at end of file