diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..92f0c9d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,34 @@ +name: Build and Publish Docker Image + +on: + push: + branches: [ "main" ] # Modifiez si votre branche s'appelle "master" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write # Indispensable pour publier le paquet sur le dépôt + + steps: + - name: Checkout du code + uses: actions/checkout@v4 + + - name: Connexion au registre GitHub (ghcr.io) + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Construction et publication de l'image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file