name: Build and Push Docker Image on: push: branches: - main # Changez cela si votre branche principale a un autre nom env: IMAGE_NAME: public/calibre-web TAG: latest REGISTRY_USER: eric@coissac.eu IMAGE_REGISTRY: niepce.petite-maison-orange.fr REGISTRY_PASSWORD: ${{ secrets.NIEPCETOKEN }} CHECK: https://haoma.petite-maison-orange.fr/ping/7e80fab1-f1ed-4ece-81aa-cf9061cda5c4 RELEASE_FILE: calibre_web_latest.txt jobs: build: runs-on: ubuntu-latest steps: - name: Start the job run: | curl -fsS -m 10 --retry 5 \ ${{ env.CHECK }}/start shell: bash - name: install Buildah run: | apt-get update apt-get install -y buildah \ podman - name: Checkout code uses: actions/checkout@v4 - name: Build image starting run: | curl -fsS -m 10 --retry 5 \ --data-raw "Buildind docker image for $(cat ${{ env.RELEASE_FILE }})" \ ${{ env.CHECK }}/log shell: bash - name: Read version file id: version run: | # Lire le contenu du fichier et supprimer les espaces/retours chariots VERSION=$(cat ${{ env.RELEASE_FILE }} | tr -d ' \n') # Stocker la valeur dans une variable d'environnement echo "VERSION=$VERSION" >> $GITEA_ENV - name: Set up Buildah id: build-image uses: redhat-actions/buildah-build@v2 with: image: ${{ env.IMAGE_NAME }} tags: latest pmo-${{ env.VERSION }} containerfiles: | ./Dockerfile - name: Canceled building if: cancelled() run: | curl -fsS -m 10 --retry 5 \ --data-raw "Building image cancelled for $(cat ${{ env.RELEASE_FILE }})" \ ${{ env.CHECK }}/fail exit 1 shell: bash - name: Build image failed if: failure() run: | curl -fsS -m 10 --retry 5 \ --data-raw "Failed to build docker image for $(cat ${{ env.RELEASE_FILE }})" \ ${{ env.CHECK }}/fail exit 1 shell: bash - name: Push to Niepce Container Repository id: push-to-niepce uses: redhat-actions/push-to-registry@v2 with: image: ${{ steps.build-image.outputs.image }} tags: ${{ steps.build-image.outputs.tags }} registry: ${{ env.IMAGE_REGISTRY }} username: ${{ env.REGISTRY_USER }} password: ${{ env.REGISTRY_PASSWORD }} - name: Push image failed if: failure() run: | curl -fsS -m 10 --retry 5 \ --data-raw "Failed to push docker image for $(cat bluesky_crossposter_latest.txt)" \ ${{ env.CHECK }}/fail exit 1 shell: bash - name: End of the job run: | curl -fsS -m 10 --retry 5 \ --data-raw "Build docker image for $(cat bluesky_crossposter_latest.txt)" \ ${{ env.CHECK }} shell: bash - name: Canceled building if: cancelled() run: | curl -fsS -m 10 --retry 5 \ --data-raw "Building image cancelled for $(cat bluesky_crossposter_latest.txt)" \ ${{ env.CHECK }}/fail exit 1 shell: bash name: Build and Push Docker Image on: push: branches: - main # Changez cela si votre branche principale a un autre nom jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Gitea Docker Registry uses: docker/login-action@v3 with: registry: gargoton.petite-maison-orange.fr username: eric password: ${{ secrets.GARGOTONTOKEN }} # Assurez-vous d'ajouter ce secret dans Gitea - name: Build and push Docker image run: | docker build --tag gargoton.petite-maison-orange.fr/image/calibre-web:latest . - name: Push Docker image run: | docker push gargoton.petite-maison-orange.fr/image/calibre-web:latest