test CI 3
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
f75579fe99
commit
9603dbbb53
@ -1,23 +1,48 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: deploy
|
||||
|
||||
steps:
|
||||
- name: Pull, tag and push existing Docker image
|
||||
image: docker
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: docker_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: docker_password
|
||||
commands:
|
||||
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD hub.codefirst.iut.uca.fr
|
||||
- docker pull hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest
|
||||
- docker tag hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:deploy
|
||||
- docker push hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:deploy
|
||||
name: CI
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: mcr.microsoft.com/dotnet/sdk:7.0
|
||||
commands:
|
||||
- cd Sources/
|
||||
- dotnet restore MySolution.sln
|
||||
- dotnet build MySolution.sln -c Release --no-restore
|
||||
- dotnet publish WF-WebAdmin/WF-WebAdmin.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/publish
|
||||
|
||||
- name: tests
|
||||
image: mcr.microsoft.com/dotnet/sdk:7.0
|
||||
commands:
|
||||
- cd Sources/
|
||||
- dotnet restore MySolution.sln
|
||||
- dotnet test MySolution.sln --no-restore
|
||||
depends_on: [build]
|
||||
|
||||
- name: analyze
|
||||
image: mcr.microsoft.com/dotnet/sdk:7.0
|
||||
commands:
|
||||
- cd Sources/
|
||||
# Lancer l'analyse statique en forçant l'exécution des analyzers
|
||||
- dotnet build MySolution.sln -c Release --no-restore /p:RunAnalyzers=true
|
||||
depends_on: [build]
|
||||
|
||||
- name: docker_build
|
||||
image: plugins/docker
|
||||
settings:
|
||||
# Nom de l'image Docker qui hébergera votre application Blazor
|
||||
repo: hub.codefirst.iut.uca.fr/marc.chevaldonne/your-blazor-app
|
||||
# Dockerfile pour construire l'image (placé à la racine de votre dépôt)
|
||||
dockerfile: Dockerfile
|
||||
tags:
|
||||
- latest
|
||||
# Secrets pour l'authentification sur votre registry (à configurer dans Drone)
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
depends_on: [build, tests, analyze]
|
||||
|
@ -0,0 +1,17 @@
|
||||
# É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
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
RUN dotnet restore "YourBlazorApp/YourBlazorApp.csproj"
|
||||
RUN dotnet publish "YourBlazorApp/YourBlazorApp.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
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
ENTRYPOINT ["dotnet", "YourBlazorApp.dll"]
|
Loading…
Reference in new issue