# L'action `build-push-image` Cette action permet de **construire une image conteneur**, de la taguer, de la pousser vers un registre et de notifier [Healthchecks.io](https://healthchecks.io) à chaque étape. Elle intègre des fonctionnalités de gestion de versions, de notifications et supporte *Docker* ou *Podman*. --- ## 🔧 Utilisation ```yaml - name: Build and push image uses: https://gargoton.petite-maison-orange.fr/pmo-actions/build-push-image@main with: image_name: mon-projet image_tags: latest check_server: https://haoma.petite-maison-orange.fr check_uuid: x1y2z3-1234-5678-9abc-def123456789 ``` --- ## 📥 Paramètres | Nom | Obligatoire | Par défaut | Description | |------------------------|-------------|-------------------------------------|-----------------------------------------------------------------------------| | `image_name` | ✅ | – | Nom de l'image à construire | | `image_tags` | ✅ | – | Tags de l'image (séparés par des espaces) | | `add_version_tag` | ❌ | `true` | Ajoute un tag basé sur la version (ex: `pmo-1.2.3`) | | `version_tag_prefix` | ❌ | `pmo` | Préfixe du tag de version | | `build_command` | ❌ | `docker` | Outil de build (`docker`/`podman`) | | `tag_command` | ❌ | `podman` | Outil de tagging (`docker`/`podman`) | | `registry_server` | ❌ | `niepce.petite-maison-orange.fr` | URL du registre | | `registry_user` | ❌ | `${{ secrets.PMO_REGISTRY_USER }}` | Utilisateur du registre | | `registry_password` | ❌ | `${{ secrets.PMO_REGISTRY_PASSWORD }}` | Mot de passe du registre | | `version_file` | ❌ | `software_version.txt` | Fichier contenant la version | | `check_server` | ❌ | `https://haoma.petite-maison-orange.fr` | Serveur Healthchecks (vide = désactivé) | | `check_uuid` | ❌ | – | UUID de la vérification Healthchecks | | `debug` | ❌ | `false` | Active les logs de débogage | --- ## ▶️ Exemple de workflow complet ```yaml name: Build and Deploy on: [push] jobs: build: runs-on: self-hosted steps: - name: Build and push image uses: https://gargoton.petite-maison-orange.fr/pmo-actions/build-push-image@main with: image_name: api-server image_tags: "latest staging" add_version_tag: true version_tag_prefix: "v" build_command: podman registry_server: registry.example.com registry_user: ${{ secrets.REGISTRY_USER }} registry_password: ${{ secrets.REGISTRY_PASSWORD }} check_server: https://hc-ping.com check_uuid: a1b2c3d4-1234-5678-9abc-def123456789 debug: true ``` --- ## ⚙️ Comportement ### Étapes clés 1. **Notifications Healthchecks** (si activé) : - Début de la tâche (`start`) - Log pendant le build (`log`) - Échec en cas d'annulation/erreur (`fail`) - Succès final (`stop`) 2. **Gestion des versions** : - Récupère la version depuis `software_version.txt` - Ajoute un tag versionné (ex: `pmo-1.0.0`) 3. **Construction de l'image** : - Installation auto de Podman si besoin - Build avec `docker`/`podman` 4. **Push vers le registre** : - Authentification automatique - Push multi-tags --- ## 🧡 À propos Cette action fait partie des actions de la **Petite Maison Orange**. 👉 [https://gargoton.petite-maison-orange.fr/pmo-actions/](https://gargoton.petite-maison-orange.fr/pmo-actions/)