diff --git a/.drone.yml b/.drone.yml index 143b4b2..f4223fe 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,6 @@ kind: pipeline -type: docker name: CI +type: docker trigger: event: @@ -8,7 +8,7 @@ trigger: steps: - name: build - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6 + image: mcr.microsoft.com/dotnet/sdk:6.0 commands: - cd WF-WebAdmin/WF-WebAdmin - dotnet restore WF-WebAdmin.csproj @@ -16,7 +16,7 @@ steps: - dotnet publish WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/publish - name: tests - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6 + image: mcr.microsoft.com/dotnet/sdk:6.0 commands: - cd WF-WebAdmin/WF-WebAdmin - dotnet restore WF-WebAdmin.csproj @@ -41,7 +41,7 @@ steps: from_secret: sonar_token project_key: web_admin coverage_exclusions: "Tests/**" - depends_on: [tests] + depends_on: [ tests ] - name: generate-and-deploy-docs image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer @@ -71,14 +71,20 @@ steps: depends_on: [ build, tests, code-analysis ] - name: deploy - image: hub.codefirst.iut.uca.fr/celeste.barbosa/codefirst-dockerproxy-clientdrone + image: mcr.microsoft.com/dotnet/aspnet:6.0 environment: IMAGENAME: hub.codefirst.iut.uca.fr/whatthefantasy/wf-webadmin CONTAINERNAME: WF-WebAdmin COMMAND: create OVERWRITE: true ADMINS: maximerocher,kevinmondejar,lenibeaulaton,kentinbrongniart,tommynguyen + commands: + - dotnet /app/WF-WebAdmin.dll when: branch: - master depends_on: [ docker_build ] + +volumes: + - name: docs + temp: {} \ No newline at end of file diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 69c0975..08390ff 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,17 +1,22 @@ -# Étape de base avec l'image runtime ASP.NET -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base -WORKDIR /app -EXPOSE 80 - -# Étape de build pour publier l'application -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +# Étape 1 : Build de l'application +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src + +# Copier les fichiers de solution et restaurer les dépendances +COPY WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj ./WF-WebAdmin/WF-WebAdmin/ +RUN dotnet restore ./WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj + +# Copier tout le reste et publier COPY . . -RUN dotnet restore "WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj" -RUN dotnet publish "WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj" -c Release -o /app/publish +RUN dotnet publish ./WF-WebAdmin/WF-WebAdmin/WF-WebAdmin.csproj -c Release -o /app/publish -# Étape finale : copie des fichiers publiés et définition du point d'entrée -FROM base AS final +# Étape 2 : Image runtime +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime WORKDIR /app COPY --from=build /app/publish . + +# Exposer le port utilisé par l'application +EXPOSE 5000 + +# Lancer l'application ENTRYPOINT ["dotnet", "WF-WebAdmin.dll"]