Skip to content

Build, Docker, CI, environnements

Environnements

EnvASPNETCORE_ENVIRONMENTURLSpecificites
DevelopmentDevelopmentlocalhostappsettings.local.json charge en surcouche, Razor runtime compilation, pas de Sentry, page d'exception detaillee
StagingStagingmetiersdart.spektrum.mediaSentry + profiling actifs (si SentryUrl), URL rewrite actif, sujets mail prefixes [STAGING], job de rappel JEMA desactive
ProductionProductionmetiersdart.chSentry (sample 10 %), URL rewrite actif, job de rappel JEMA actif

Hebergement : VM Azure Columbia, conteneur Docker Linux derriere docker-compose (hosting/docker-compose.yml, image columbia-registry.spektrum.media/umb_metiersdart:{staging|prod}, port 5001:5000). Volumes montes : appsettings.json, wwwroot/media, umbraco/Logs.

Base de donnees

  • SQL Server (VM Azure vmsqla001). Bases : umb_metiers-d-art_staging, umb_metiers-d-art_production, umb_metiers-d-art_dev en local.
  • Chaine umbracoDbDSN dans appsettings.json (provider Microsoft.Data.SqlClient).
  • Umbraco:CMS:Unattended:UpgradeUnattended = true (migration de schema Umbraco automatique au demarrage).
  • uSync importe le groupe Settings au demarrage (ImportAtStartup: Settings) ; DictionaryHandler en CreateOnly.

Dockerfile (hosting/Dockerfile, multi-stage Linux)

  1. Build stage (dotnet/sdk:10.0) : installe Node 22.x, copie src/Web, dotnet restore, npm ci + npm run build:prod.
  2. Adapte le style backoffice selon ENVIRONMENT (arg, staging/prod) : copie backoffice-env.{branch}.css (prod -> master).
  3. dotnet publish -c Release -o /app/publish, puis copie explicite de wwwroot/css/* et wwwroot/js/* dans le publish (car dotnet publish ignore les assets generes par Vite).
  4. Runtime stage (dotnet/aspnet:10.0) : ENTRYPOINT ["dotnet", "Web.dll"].

CI - deux pipelines coexistent

GitLab CI (.gitlab-ci.yml)

  • Stage build uniquement. Job build:staging (branche staging) et build:production (branche master) via un template .build_template : docker build avec cache (--cache-from), tags staging/prod + $CI_COMMIT_SHORT_SHA, push vers registry.internal.spektrum-suisse.ch/metiersdart-website.
  • Runner linux, Docker-in-Docker (docker:25-dind).
  • Cablage docs (ajoute) : composant sync-claude-docs sur le stage docs, declenche sur main/master/staging quand .claude/docs/**/* change (ou sur run web manuel). Voir la section docs du fichier.

CircleCI (.circleci/config.yml)

  • Jobs : front-end-build (Node 22, npm run build:prod, adapte le style backoffice), back-end-build-and-test (dotnet build + dotnet test), generate-and-store-artifacts (publish + tar stocke en artifact), deploy (build + push image columbia-registry.spektrum.media/umb_metiersdart:{production|staging}).
  • Workflows par branche (staging, et equivalent master/production). Contextes metiersdart-staging / prod.

Commandes locales

bash
dotnet build MetiersDArtWebsite.sln
dotnet test MetiersDArtWebsite.sln
dotnet run --project src/Web

cd src/Web && npm install && npm run build      # assets

Gotchas

  • Ne pas committer appsettings.local.json ni de secrets (SMTP, Sentry, newsletter, dashboard) : vides en repo, injectes par environnement.
  • Les assets Vite doivent etre dans wwwroot/css|js avant le publish (gere par le Dockerfile en local/CI ; en dev, lancer npm run build).
  • Le job de rappel JEMA ne tourne pas en dev/staging (court-circuit dans JemaEmailReminderJob.Execute).
  • rewriteRules.xml n'est applique qu'en staging/prod.

Contributors

No contributors

Changelog

No recent changes